问题描述
在我的代码中引用OpenFEC(openfec.org)-函数时出现此问题:
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
包含这些功能的c文件包含在openfec库中.
The c-files containing these functions are included in the openfec-library.
命令nm ../openfeclib/libopenfec.so | grep of_release_codec
给出:
000000000001a294 T of_release_codec_instance
我该如何解决?
推荐答案
我(终于!!)在FFMpeg邮件列表中提到了该解决方案: http: //ffmpeg.org/faq.html#I_0027m-using-FFmpeg-from-within-my-C_002b_002b-application-but-the-linker-complains-about-missing-symbols-似乎已可用_002e
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
引用:"FFmpeg是一个纯C项目,因此要在C ++应用程序中使用这些库,您需要明确声明您正在使用C库.您可以通过包含FFmpeg包括使用外部"C"的方式来做到这一点. "
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"."
我对FFMpeg问题和OpenFEC库问题都应用了相同的解决方案.
I applied the same solution to my FFMpeg-problem to the OpenFEC-library-problem.
这篇关于尽管在OpenFEC库中进行了链接但未定义参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!