Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wxWidgets setup in Microsoft Visual Studio 2017

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

like image 233
DefenceWarfare Avatar asked Dec 29 '17 19:12

DefenceWarfare


1 Answers

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.

like image 136
VZ. Avatar answered Sep 28 '22 18:09

VZ.