I get this problem when referring to OpenFEC (openfec.org)-functions in my code:
anders@ubuntu:~/workspace/fectest$ gcc -L../openfeclib/ -l'openfec' -I../openfeclib fectest.cpp
/tmp/ccEXLrdc.o: In function `main':
fectest.cpp:(.text+0x17a): undefined reference to `of_create_codec_instance(of_session**, of_codec_id_t, unsigned char, unsigned int)'
fectest.cpp:(.text+0x2db): undefined reference to `of_set_fec_parameters(of_session*, of_parameters*)'
fectest.cpp:(.text+0x347): undefined reference to `of_build_repair_symbol(of_session*, void**, unsigned int)'
fectest.cpp:(.text+0x395): undefined reference to `of_release_codec_instance(of_session*)'
collect2: ld returnerade avslutningsstatus 1
The c-files containing these functions are included in the openfec-library.
The command nm ../openfeclib/libopenfec.so | grep of_release_codec gives:
000000000001a294 T of_release_codec_instance
How do I resolve this?
I was (finally!!) referred to the solution in the FFMpeg-mailing list: http://ffmpeg.org/faq.html#I_0027m-using-FFmpeg-from-within-my-C_002b_002b-application-but-the-linker-complains-about-missing-symbols-which-seem-to-be-available_002e
Quote: “FFmpeg is a pure C project, so to use the libraries within your C++ application you need to explicitly state that you are using a C library. You can do this by encompassing your FFmpeg includes using extern “C”.”
I applied the same solution to my FFMpeg-problem to the OpenFEC-library-problem.