compilation - C: undefined reference... to library used successfully elsewhere -



compilation - C: undefined reference... to library used successfully elsewhere -

i trying compile c++ project (openframeworks + codeblocks), using external c library. "undefined reference" error, although succesfully compile , utilize library elsewhere.

the code consists of sources main.cpp, testapp.cpp , header files, including 1 library "myprocessing". when make , code compiled , dies @ linking error

obj/i686release/./src/testapp.o: in function `testapp::update()': testapp.cpp:(.text+0x261): undefined reference `gauss_5(datarect_t)' collect2: ld returned 1 exit status make: *** [bin/facegrabber] error 1

where gauss_5 library function, , called in testapp.cpp (header declarations included there).

below paste make commands used compile code, generated codeblocks (i strip clarity)

# compiling object for: ./src/testapp.cpp g++ -c -g [some -i...] -dof_using_gtk -dof_using_mpg123 -wall -fexceptions -i. -ilib/ -mmd -mp -mfobj/i686debug/./src/testapp.d -mtobj/i686debug/./src/testapp.d -oobj/i686debug/./src/testapp.o -c ./src/testapp.cpp # compiling object for: ./src/main.cpp g++ -c -g -pthread [some -i...] -dof_using_gtk -dof_using_mpg123 -wall -fexceptions -i. -ilib/ -mmd -mp -mfobj/i686debug/./src/main.d -mtobj/i686debug/./src/main.d -oobj/i686debug/./src/main.o -c ./src/main.cpp # linking bin/facegrabber_debug . ./src ./lib g++ -o bin/facegrabber_debug obj/i686debug/./src/testapp.o obj/i686debug/./src/main.o -wl,-rpath=./libs -llib/ -lz -lmyprocessing [some libs...]

note library referenced (-lmyprocessing) in last, linking step. so, headers , libraries found compiler, somehow not compiled-in.

i tried both .a static , .so dynamic files myprocessing, unsuccessfully. mentioned, utilize same library in other project (outside openframeworks , codeblocks) , works.

you library written in c. however, fact linker able print out type of argument gauss_5() suggests it's working mangled, c++ name of function.

i suspect might missing extern "c" { ... } guards around c header.

c compilation

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -