Reputation: 71
I've been trying to figure out for about 20 hours how to setup wxWidgets in Microsoft visual studio 2017. I've followed:
https://wiki.wxwidgets.org/Microsoft_Visual_C%2B%2B_Guide
https://raw.githubusercontent.com/wxWidgets/wxWidgets/WX_3_0_BRANCH/docs/msw/install.txt
and other numerous websites on how to set it up. I've even followed some of the posts in this website like and youtube:
How to set up wxWidgets 3.1.0 with Visual Studio 2015
I am literally stuck: I compiled it from source. And I believe I had no problem with it. I compiled it statically (DEBUG/RELEASE)...
Everytime I follow the tutorials and posts I get very weird messages...
Would there be anyone with a kind heart bother to spend some of his time to show me how to setup wxWidgets for Microsoft visual studio 2017 (Project Setup or something) fully?
Every answer would be appreciated :|
Sorry for not providing you guys with enough information.
https://wiki.wxwidgets.org/Microsoft_Visual_C%2B%2B_Guide
Been following the above link... The "Creating a new project by hand" didn't work
With the "Creating a new project from a sample":
Used the minimal sample instead of the internat because it had a solution file (internat didn't)...
I modified the .sln and .vcxproj file (replaced ../.. .... with the wxWidgets directory) and when tried to compile some simple code got plenty of errors like: "cannot open source file "wx.wx.h". So I went to project properties/ vc++ directories and specified the include and lib locations
Include Directories: C:\wxWidgets-3.1.0/include C:\wxWidgets-3.1.0/include/msvc
Libraries Directories C:\wxWidgets-3.1.0/lib/vc_lib
And then I got LOTS of errors like "could not open C:\wxWidgets-3.1.0\samples.RC
So I opened the project file as notepad and added the source.rc location:
ItemGroup ResourceCompile Include="C:\wxWidgets-3.1.0\samples\sample.rc" / and the source.rc disappeared, but the so 50 errors were still there:
(e.g. Error C2491 'wxBitmapButton::ms_classInfo': definition of dllimport static data member not allowed core C:\wxWidgets-3.1.0\src\common\bmpbtncmn.cpp 71)
Is there any easy way of setting up wxWidgets?
How to set up wxWidgets 3.1.0 with Visual Studio 2015
In the above link the bottom of the first answer "The next step is to copy the samples\minimal folder somewhere and start writing the code. All you will need to do is to change the Include and Lib search path."
I didn't really understand what he meant. I really need further clarification. It may solve all the horrible errors I have encountered.
This "question" may be super messy but I have no choice other than ask more experienced programmers for help...
Don't give up on me this quickly :3
Upvotes: 7
Views: 10543
Reputation: 1
I also encountered this problem. None of the wxWidgets documentation mentioned this solution but it worked for me. I renamed the dll files in the lib subfolder of my wxWidgets folder
from: VC_X64.DLL & VC_X64.LIB
to: VCnnn_X64.DLL & VCnnn_X64.LIB
where nnn is the version number of Visual Studio.
Upvotes: 0
Reputation: 37
Had the same issue after following all the instructions. Fixed by restarting my machine. I am following a tutorial that had me set an environment variable for wxWidgets and use that in the project properties under Additional Include Directories. It looked fine - when I brought up cmd and echoed %WXWIN% it showed the correct directory, so it looked like it applied without needing a restart, but Visual Studio gave the error that it couldn't open "wx\wx.h" even after restarting VS.
So, I restarted the whole machine, now it's working fine.
Upvotes: 0
Reputation: 461
All that I needed to compile wxWidgets "Hello world" Debug x64 on Visual Studio 2019:
<wx_dir>\build\msw\wx_vc12.sln
and x64 Debug and Release configurationswxIMPLEMENT_APP(MyApp);
to wxIMPLEMENT_APP_CONSOLE(MyApp);
<wx_dir>\include and <wx_dir>\include\msvc
<wx_dir>\lib\vc_x64_lib
wxmsw30ud_core.lib;wxbase30ud.lib;
wxStrcoll: identifier not found
Hope it will help smb.
Upvotes: 2
Reputation: 475
So using any of the xxxVC15.sln files, all I had to do to remove all of my various build errors was to go to Tools -> Get Tools and Features and install 'Windows 8.1 SDK and UCRT SDK'
Very first error I had was Windows 8 SDK related, but after that is when I had a ton of "could not find xyz" errors. Just started using Visual Studio, but apparently between 2015 and 2017, visual studio changed the location/lookup point of C libraries that cause issues in the wxMSW .sln files. Installing 'Windows 8.1 SDK and UCRT SDK' fixed it for
Upvotes: 1
Reputation: 21
I've been trying for many hours, just like you and, at the end the problem was that my libs are x64 and I had set x86 in Visual Studio (on the main window, to the left of the button Debug). In case it could help
Upvotes: 2
Reputation: 1
Try to use the precompiled binaries for VS2017. On C++ directories: Add /include Add /lib Evidently, for the headers, and libraries of wxWidgets, respectively. Finally, link the base, and the core library files of wxWidgets to your project. Write some standard basic example from the official website of wxWidgets. All should run fine.
Upvotes: 0
Reputation: 22753
To use wxWidgets in your application, create a new Win32 project as usual, then add $WXWIN\include\msvc;$WXWIN\include
to the compiler options ("Properties|C++|General|Additional Include Directories") and $WXWIN\lib\vc_lib
to the linker options ("Properties|Linker|Additional Library Directories"). That's all (and it's documented here).
If you use wxWidgets as DLL, also add WXUSINGDLL
to the list of definitions and replace vc_lib
with vc_dll
.
Upvotes: 2