我正在尝试编译和构建PjProject{PJSUA},其中包含音频和视频支持。但每次都会遇到错误,这是未解决的External_Symbols。
我正在使用Visual Studio 2022和工具链集最新版本v143为Windows-32-BIT构建这个项目。
我想初始化各种编解码器{OPUS、OPENH264、FFMPEG、OPENSSL、SDL等}。我只想问一下OPUS库。
步骤如下:
-
获得了最新版本的PjProject的源代码,并在Visual Studio 2022中加载了该项目。
-
在编译和构建LibOpus后,请提及Opus Include目录和Opus Library目录。
-
将PJSUA作为源项目,将配置设置为Debug-Static-W32,并开始构建项目。
注意
- 已经包含了SDL头和lib文件等其他添加依赖项
- config_site.h已用于定义编解码器使用{#define PJMEDIA_HAS_OPUS_codec 1}
我在错误日志中收到的错误如下:
Error LNK2019 unresolved external symbol _opus_encoder_get_size referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_encoder_init referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_encode referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_encoder_ctl referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_decoder_get_size referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_decoder_init referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_decode referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_packet_get_nb_samples referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_repacketizer_get_size referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_repacketizer_init referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_repacketizer_cat referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_repacketizer_out_range referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_repacketizer_get_nb_frames referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK2019 unresolved external symbol _opus_repacketizer_out referenced in function _pjmedia_codec_opus_set_default_param pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbuildlibpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj) 1
Error LNK1120 14 unresolved externals pjsua C:UserscoralDesktoppjproject-masterpjsip-appsbinpjsua-i386-Win32-vc14-Debug-Static.exe 1
我能找到一种更简单的方法吗?这样我就可以通过解决它来消除所有这些错误,并编译和构建包含OPUS CODEC的PJSUA。
经过长时间的尝试,我得到了如下解决方案:
- 在config_site.h中,我们需要提到并激活我们的编解码器以进行编译,如#define PJMEDIA_HAS_OPUS_codec
#define PJMEDIA_HAS_OPUS_CODEC必须在整个程序中处于活动状态,并且必须从程序中清楚地删除#define PJMEDIA_HAS_OPES_CODEC1的其余函数行,以便于编译,从而调试在构建过程中调用的不同函数。
我仍然认为,在windows上构建时,使用Microsoft Visual Studio最新版本和最新工具集来编译和构建单个链接器的不同程序。