Search code examples
c++sippjsipvisual-studio-2022pjsua2

Building MicroSIP 3.20.7: Showing error "Unresolved External Symbols"


I am trying to build MicroSIP version 3.20.7 for Windows 10 64-bit Operating System.

I already build PjProject (As mentioned in the documentation) and obtained all the .lib files for the same and now I am trying to use those .lib files for building MicroSIP as mentioned in the documentation over their website.

But I fall for an error of Unresolved External Symbols that is LNK2019 / LNK2001 / LNK1120.

(An image for the reference have been attached)

I am concluding with following steps.

  1. Download the source for PjProject and extract the source using 7Zip.
  2. Added a config_site.h file in the pjlib\include\pj.
  3. Using Visual Studio 2022, Open PjProject and select pjsua as the source project.
  4. Setting up the configuration for the project as -> Debug-Static for x64. and Build.
  5. After a successfull build I got all the .lib files for the PjProject and successfully deployed the pjsua project showing a cli menu for PjSIP.
  6. Now, I downloaded the latest source of MicroSIP 3.20.7 from the official website and extracted the source code using 7Zip.
  7. Setting the configuration for the project as Debug for x64, and including all the header files and library files from windows kit as well as the other media libraries to the Include Directories and Library Directories {Opus, SDL2, FFMPEG,x264, VPX, PjProject}
  8. I started to build the MicroSIP 3.20.7 and obtained the MicroSIP.lib file successfully.

But at the last where the build must give an executable file for MicroSIP, there are the list of error stating Unresolved External Symbols {LNK2019 / LNK2001 / LNK1120}

Below is the link to the image having all the error in console windows.

enter image description here

The error states the following message.

  1. unresolved external symbol pjmedia_get_vid_subsys referenced in function "public: void __cdecl CmainDlg::OnTimer(unsigned __int64)" (?OnTimer@CmainDlg@@QEAAX_K@Z)

  2. unresolved external symbol pjmedia_vid_dev_refrence referenced in function "public: void __cdecl CmainDlg::OnTimer(unsigned __int64)" (?OnTimer@CmainDlg@@QEAAX_K@Z).

etc there are other 17 error (Kindly take the refrence of above image.)

Below is the link to the image having error logged in output tab.

enter image description here


These are the message logged into the output tab

Build started...
1>------ Build started: Project: microsip, Configuration: Debug x64 ------
1>stdafx.cpp
1>AAOptionsDlg.cpp
1>AccountDlg.cpp
1>AddDlg.cpp
1>addons.cpp
1>BaseDialog.cpp
1>ButtonDialer.cpp
1>Calls.cpp
1>CListCtrl_Sortable.cpp
1>CListCtrl_SortItemsEx.cpp
1>ClosableTabCtrl.cpp
1>Contacts.cpp
1>Dialer.cpp

1>C:\msys64\home\coral\tmp\sources\MicroSIP-3.20.7-src\lib\MessageBoxX.h(38,1): warning C4005: '_NODISCARD': macro redefinition (compiling source file Contacts.cpp)

1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\vcruntime.h(319): message : see previous definition of '_NODISCARD' (compiling source file Contacts.cpp)

1>global.cpp
1>IconButton.cpp
1>jumplist.cpp
1>CListCtrl_ToolTip.cpp
1>CMask.cpp
1>Crypto.cpp
1>CSVFile.cpp
1>Hid.cpp
1>json_reader.cpp
1>json_value.cpp
1>json_writer.cpp
1>langpack.cpp
1>LevelsSliderCtrl.cpp
1>Markup.cpp
1>MessageBoxX.cpp
1>ModelessMessageBox.cpp
1>MSIP.cpp
1>StdioFileEx.cpp

1>C:\msys64\home\coral\tmp\sources\MicroSIP-3.20.7-src\lib\MessageBoxX.h(38,1): warning C4005: '_NODISCARD': macro redefinition (compiling source file lib\MessageBoxX.cpp)

1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\include\vcruntime.h(319): message : see previous definition of '_NODISCARD' (compiling source file lib\MessageBoxX.cpp)

1>utf.cpp
1>VisualStylesXP.cpp
1>mainDlg.cpp
1>MessagesDlg.cpp
1>microsip.cpp
1>Preview.cpp
1>RinginDlg.cpp
1>settings.cpp
1>SettingsDlg.cpp
1>ShortcutsDlg.cpp
1>StatusBar.cpp
1>Transfer.cpp

1>   Creating library C:\msys64\home\coral\tmp\sources\MicroSIP-3.20.7-src\x64\Debug\microsip.lib and object C:\msys64\home\coral\tmp\sources\MicroSIP-3.20.7-src\x64\Debug\microsip.exp

1>mainDlg.obj : error LNK2019: unresolved external symbol pjmedia_get_vid_subsys referenced in function "public: void __cdecl CmainDlg::OnTimer(unsigned __int64)" (?OnTimer@CmainDlg@@QEAAX_K@Z)

1>mainDlg.obj : error LNK2019: unresolved external symbol pjmedia_vid_dev_refresh referenced in function "public: void __cdecl CmainDlg::OnTimer(unsigned __int64)" (?OnTimer@CmainDlg@@QEAAX_K@Z)

1>mainDlg.obj : error LNK2019: unresolved external symbol pjsua_vid_enum_devs referenced in function "public: int __cdecl CmainDlg::VideoCaptureDeviceId(class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > >)" (?VideoCaptureDeviceId@CmainDlg@@QEAAHV?$CStringT@_WV?$StrTraitMFC@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z)

1>SettingsDlg.obj : error LNK2001: unresolved external symbol pjsua_vid_enum_devs

1>mainDlg.obj : error LNK2019: unresolved external symbol pjsua_vid_codec_set_priority referenced in function "public: void __cdecl CmainDlg::PJCreateRaw(void)" (?PJCreateRaw@CmainDlg@@QEAAXXZ)

1>mainDlg.obj : error LNK2019: unresolved external symbol pjsua_vid_codec_get_param referenced in function "public: void __cdecl CmainDlg::PJCreateRaw(void)" (?PJCreateRaw@CmainDlg@@QEAAXXZ)

1>SettingsDlg.obj : error LNK2001: unresolved external symbol pjsua_vid_codec_get_param

1>mainDlg.obj : error LNK2019: unresolved external symbol pjsua_vid_codec_set_param referenced in function "public: void __cdecl CmainDlg::PJCreateRaw(void)" (?PJCreateRaw@CmainDlg@@QEAAXXZ)

1>Preview.obj : error LNK2019: unresolved external symbol pjsua_vid_preview_param_default referenced in function "public: void __cdecl Preview::Start(int)" (?Start@Preview@@QEAAXH@Z)

1>Preview.obj : error LNK2019: unresolved external symbol pjsua_vid_preview_start referenced in function "public: void __cdecl Preview::Start(int)" (?Start@Preview@@QEAAXH@Z)

1>Preview.obj : error LNK2019: unresolved external symbol pjsua_vid_preview_get_win referenced in function "public: void __cdecl Preview::Start(int)" (?Start@Preview@@QEAAXH@Z)

1>Preview.obj : error LNK2019: unresolved external symbol pjsua_vid_preview_stop referenced in function "protected: void __cdecl Preview::OnDestroy(void)" (?OnDestroy@Preview@@IEAAXXZ)

1>Preview.obj : error LNK2019: unresolved external symbol pjsua_vid_win_get_info referenced in function "public: void __cdecl Preview::Start(int)" (?Start@Preview@@QEAAXH@Z)

1>Preview.obj : error LNK2019: unresolved external symbol pjsua_vid_win_set_pos referenced in function "public: void __cdecl Preview::Start(int)" (?Start@Preview@@QEAAXH@Z)

1>Preview.obj : error LNK2019: unresolved external symbol pjsua_vid_win_set_size referenced in function "public: void __cdecl Preview::Start(int)" (?Start@Preview@@QEAAXH@Z)

1>SettingsDlg.obj : error LNK2019: unresolved external symbol pjsua_vid_enum_codecs referenced in function "protected: virtual int __cdecl SettingsDlg::OnInitDialog(void)" (?OnInitDialog@SettingsDlg@@MEAAHXZ)

1>C:\msys64\home\coral\tmp\sources\MicroSIP-3.20.7-src\x64\Debug\microsip.exe : fatal error LNK1120: 14 unresolved externals

1>Done building project "microsip.vcxproj" -- FAILED.

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Here is the following that what I have tried to solve these errors.

  • Checked for the correct linking of Include files to Include directory.
  • Checked for the correct linking of Library files to Library directory.
  • Checked the name of library and executable files in both PjSIP and MicroSIP

But stills the same error is present. It's been over a week that I'm scratching my head for this and atlast I am asking, so kindly look into my problem and provide a legit guidance to get rid of these errors from my project.

I am using Visual Studio 2022. I am using latest version of Windows Kit for Windows 10 that is 10.0.20348.0.

What shall I do next to get a MicroSIP executable file, from building the project from source ?


Solution

  • So basically I figured out what was wrong in the project.

    If we don't want to use video option we can terminated the Global_Constant_Video option in constant.h, which will surely build the application but without Video support in it. If enabling video is an option that need to be opted therefore, you need to clean and rebuild the PJSUA Cli Menu Application again by Adding video support to it along with the preferred video codec and use the obtained libraries to build the MicroSIP application from the starting.

    Hope you find it easy, Just be involved with the codes.

    Cheers