我要编译PJSIP
编译器CPP
。因为我正在将API与PJSIP
集成。它在CPP
。所以我必须使用g++
而不是gcc
。但是现在我没有集成任何其他API。如何解决C++编译器中的链接器错误
但我在CPP
编译器中收到链接器错误。如果它是C
编译器,它工作正常。
错误:
Undefined symbols for architecture arm: "_crypto_alloc", referenced from: srtp_stream_clone(srtp_stream_ctx_t const*, unsigned int, srtp_stream_ctx_t**)in libsrtp-arm-apple-darwin9.a(srtp.o) srtp_stream_alloc(srtp_stream_ctx_t**, srtp_policy_t const*) in libsrtp-arm-apple-darwin9.a(srtp.o) _srtp_create in libsrtp-arm-apple-darwin9.a(srtp.o) "_aes_icm_context_init", referenced from: srtp_kdf_init(srtp_kdf_t*, unsigned char const*)in libsrtp-arm-apple-darwin9.a(srtp.o) "_crypto_kernel_load_debug_module", referenced from: _srtp_init in libsrtp-arm-apple-darwin9.a(srtp.o) "_rdbx_init", referenced from: srtp_stream_init(srtp_stream_ctx_t*, srtp_policy_t const*) in libsrtp-arm-apple-darwin9.a(srtp.o) srtp_stream_clone(srtp_stream_ctx_t const*, unsigned int, srtp_stream_ctx_t**)in libsrtp-arm-apple-darwin9.a(srtp.o) "_key_limit_clone", referenced from: srtp_stream_clone(srtp_stream_ctx_t const*, unsigned int, srtp_stream_ctx_t**)in libsrtp-arm-apple-darwin9.a(srtp.o) "_auth_get_tag_length", referenced from: _srtp_unprotect_rtcp in libsrtp-arm-apple-darwin9.a(srtp.o) _srtp_protect_rtcp in libsrtp-arm-apple-darwin9.a(srtp.o) _srtp_unprotect in libsrtp-arm-apple-darwin9.a(srtp.o) _srtp_protect in libsrtp-arm-apple-darwin9.a(srtp.o) ... ...
其实我没有makefile
改变任何东西。
注: 在srtp.c
文件中,已经包含alloc.h
文件。我赞扬它并编译它。我只有相同的链接器错误。我以两种方式思考。但我不确定这一点。
1.它不链接.o
文件
2.它没有取头文件。 (我不清楚这个。)
请帮我解决这个问题。
顺便说一下,'CPP'意味着C预处理器。 'C++'表示C + plus。 –
你是否清楚“编译”和“链接”之间的区别,并且C++不能编译C和C不能编译C++,但是如果一个链接器在单独调用和之后调用,C++可以导出到C? –
我们可以用C编译器编译C++编译器和C++代码。但事情是;如果您在C++代码中使用命名空间等,则无法使用C编译器编译C++代码。 – jfalexvijay