codecpjsipunresolved-externalopuspjsua2

Error while Compiling Opus Library with PjSip {PJSUA}


I am trying to compile and build PjProject {PJSUA}, with both audio and video support into it. But falling into the errors everytime which is Unresolved_External_Symbols.

I am building this project for Windows-32-BIT using Visual Studio 2022 and toolchain set latest version that is v143.

I want to intialize the various codec {OPUS, OPENH264, FFMPEG, OPENSSL, SDL etc}. I will just ask about the OPUS LIBRARY.

The steps are as follows:

  1. Got the source of latest version of PjProject and loaded the project in Visual Studio 2022.

  2. Mention the Opus Include directory and Opus Library Directory after compiling and building LibOpus.

  3. Making PJSUA as source project and Setting configuration as Debug-Static-Win32 and start building the project.

NOTE

The error that I have received into the error log are as following:

Error   LNK2019 unresolved external symbol _opus_encoder_get_size referenced in function _pjmedia_codec_opus_set_default_param  pjsua   C:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-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:\Users\coral\Desktop\pjproject-master\pjsip-apps\build\libpjproject-i386-Win32-vc14-Debug-Static.lib(opus.obj)    1
Error   LNK1120 14 unresolved externals pjsua   C:\Users\coral\Desktop\pjproject-master\pjsip-apps\bin\pjsua-i386-Win32-vc14-Debug-Static.exe   1

Can I get a simpler way so that I can get rid of all these errors by soving it and compile and build my PJSUA with OPUS CODEC included into it.


Solution

  • After a long try I get the solution as following:

    1. In config_site.h we need to mention and activate our codec for compilation as #define PJMEDIA_HAS_OPUS_CODEC

    #define PJMEDIA_HAS_OPUS_CODEC must be active througout the program and rest function line that is #define PJMEDIA_HAS_OPUS_CODEC 1 must be clearly removed from the program to find the ease for the compilation which will ommit out the different function those are called during the build.

    I would still refer that while building on windows use Microsoft Visual Studio latest Version along with the latest toolset to compile and built different programs for a Single Linker.