Visual Studio 2019 issue with static linking
Posted: Tue Sep 03, 2019 12:35 am
I'm trying to build my project with Visual Studio 2019 and the static wxWidgets libraries, but I keep running into linker errors. I have no problems building the project with the DLL libraries, only the static ones.
What I did:
Create new Project in VS by importing from existing code. I add my source directory. I make no other changes here.
I add the following paths to my Additional Includes in C/C++ project settings and Resource compiler settings (Release)
I added C:\wxWidgets-3.0.4\lib\vc_lib to my additional linker directories.
I added all the .lib files I could fine in the vc_lib directory.
I do NOT have WXUSINGDLL defined in the PREPROCESSOR settings.
All the unresolved symbols reference wxmsw30u_core.lib.
Is there a step I'm missing?
If I change the vc_lib to vc_dll, and set the WXUSINGDLL PP directive, I can get it to link against the DLL library. I'm not sure what the difference is between static and DLL is here.
I tried comparing one of the sample programs vcprojx file, but I don't see any differences other than the sample uses relative paths.
Thanks.
What I did:
Create new Project in VS by importing from existing code. I add my source directory. I make no other changes here.
I add the following paths to my Additional Includes in C/C++ project settings and Resource compiler settings (Release)
Code: Select all
..\source;C:\wxWidgets-3.0.4\lib\vc_lib\mswu;C:\wxWidgets-3.0.4\include;C:\wxWidgets-3.0.4\include\msvc
I added all the .lib files I could fine in the vc_lib directory.
Code: Select all
wxbase30u.lib
wxbase30u_net.lib
wxbase30u_xml.lib
wxexpat.lib
wxjpeg.lib
wxmsw30u_adv.lib
wxmsw30u_aui.lib
wxmsw30u_core.lib
wxmsw30u_gl.lib
wxmsw30u_html.lib
wxmsw30u_media.lib
wxmsw30u_propgrid.lib
wxmsw30u_qa.lib
wxmsw30u_ribbon.lib
wxmsw30u_richtext.lib
wxmsw30u_stc.lib
wxmsw30u_webview.lib
wxmsw30u_xrc.lib
wxpng.lib
wxregexu.lib
wxscintilla.lib
wxtiff.lib
wxzlib.lib
All the unresolved symbols reference wxmsw30u_core.lib.
Code: Select all
Error LNK2001 unresolved external symbol __imp__ImageList_Create@20 dwsrame C:\Users\john\Desktop\build\dwsrame\vstudio\wxmsw30u_core.lib(ownerdrw.obj) 1
Error LNK2019 unresolved external symbol __imp__InitCommonControls@0 referenced in function "public: virtual bool __thiscall wxApp::Initialize(int &,wchar_t * *)" (?Initialize@wxApp@@UAE_NAAHPAPA_W@Z) dwsrame C:\Users\john\Desktop\build\dwsrame\vstudio\wxmsw30u_core.lib(app.obj) 1
Error LNK2019 unresolved external symbol __imp__CreateUpDownControl@48 referenced in function "public: bool __thiscall wxSpinButton::Create(class wxWindow *,int,class wxPoint const &,class wxSize const &,long,class wxString const &)" (?Create@wxSpinButton@@QAE_NPAVwxWindow@@HABVwxPoint@@ABVwxSize@@JABVwxString@@@Z) dwsrame C:\Users\john\Desktop\build\dwsrame\vstudio\wxmsw30u_core.lib(msw_spinbutt.obj) 1
If I change the vc_lib to vc_dll, and set the WXUSINGDLL PP directive, I can get it to link against the DLL library. I'm not sure what the difference is between static and DLL is here.
I tried comparing one of the sample programs vcprojx file, but I don't see any differences other than the sample uses relative paths.
Thanks.