Answer the question
In order to leave comments, you need to log in
How to add c++ sources to golang library?
The project used cgo c++ sources. I decided to put some code base into a separate package, SPP resources also went there. How to add a new package to a project?
Here is the package structure.
cpp_sources pkg
opus audio
cpp and hpp files go files
/*
#cgo linux CFLAGS: -I${SRCDIR}/../../cpp_source/opus -I/usr/include/opus
#cgo linux CPPFLAGS: -I${SRCDIR}/../../cpp_source/opus -I/usr/include/opus
#cgo linux LDFLAGS: -L${SRCDIR} -lopus_decoder_wrapper -lopus -lopusenc -lopusfile -lstdc++
#cgo darwin CFLAGS: -I${SRCDIR}/../../cpp_source/opus -I/usr/local/include/opus
#cgo darwin CPPFLAGS: -I${SRCDIR}/../../cpp_source/opus -I/usr/local/include/opus
#cgo darwin LDFLAGS: -L${SRCDIR} -lopus_decoder_wrapper -lopus -lopusenc -lopusfile -lc++
#include <opus_decoder_wrapper.h>
*/
import "C"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question