1

I tried to build the wxWidget library as suggested in the following post

How to set up wxWidgets 3.1.0 with Visual Studio 2015

Just to brief you up, these were the steps mentioned

  1. Grab the sources.
  2. Unpack the sources.
  3. Open VS IDE.
  4. Open \build\msw\wx-vc14.sln (adjust as necessary.)
  5. Go to "Build->Batch Build...", click "Select All", "Build".
  6. Go drink some coffee or watch TV.
  7. After the build finishes, open wxWidgets/samples/minimal/minimal_vc9.sln.
  8. Let MSVC convert the solution to become an appropriate format.
  9. Build and run the sample.

When I clicked on build(Step 5) after selecting all, I got many errors. Is that due to the incompatibility of the wxWidget files with Visual Studio 2017?

This is the error description

As per this description, I am supposed to change the project properties but I am not sure, change Project properties to what? I just need to develop simple Windows app.

I am a newbie to this, I recently completed learning C++ and want to develop some Windows app, so started with wxWidgets.

Nbk
  • 13
  • 1
  • 4
  • I usually make many build passes. Apparently, more errors go away after each build pass. I haven't tried with VS2017. – Thomas Matthews Aug 16 '17 at 01:04
  • There is a wx-vc15.sln in the current github sources. Perhaps that fixes the issue. – drescherjm Aug 16 '17 at 01:18
  • @Nbk, You need to go to the Microsoft web site and download SDK as the error you revceived explained. Install it on you machine and rebuild. You don't have to change anything in the solution. The instruction given to you are good. Just download and install SDK. If you have trouble - google "download windows sdk 8.1". – Igor Aug 16 '17 at 01:47
  • @Igor Thank you, this worked Now I have to build an app so created a new Windows 32 project, which had a .cpp file with all the declarations and functions and I have no idea how to start working with them, could you please suggest some good resources on how to use these libraries and develop a basic app. – Nbk Aug 17 '17 at 02:08
  • @Nbk, open the wxWIdgets/samples/minimal/minimal.sln (adjust the path accordingly and choose the one appropriate for your version). Open the project properties. Carefully copy all properties from the minimal.sln to your own adjusting the path where appropriate (pay close attention to include and library path - use the full path, not the relative one). Compile and run. If you have any problems - try to compile and run UNMODIFIED minimal sample - the one that you had opened. Post here if you have any problems. If minimal sample works - recheck the project properties. Done. – Igor Aug 17 '17 at 15:28
  • @Nbk, Also make sure that you code looks the same as minimal sample - same include files and same structure. If you need more - check all different samples that is provided by the library in the samples directory. Compile and run them. Look at their code. Enjoy! – Igor Aug 17 '17 at 15:29

2 Answers2

2

This is a strange error without an obvious reason, because as far as I've seen "8.1" SDK version is not hard-coded anywhere inside wxWidgets projects.

To workaround it:

  1. [the same] Open \build\msw\wx-vc14.sln (adjust as necessary.)

    4.1. Select all projects in Solution Explorer (click _custom_build, press Shift, click xrc);

    4.2. Right click on the selected project(s) and choose Properties; on top choose Configuration: All Configurations, Platform: All Platforms and on the left Configuration Properties->General;

    4.3. Windows SDK Version will most probably show 8.1, double-click it and it will choose the 10.x SDK version that came with your VS.

    4.4. Hit OK.

  2. Go to "Build->Build Solution".

  3. Drink less coffee, as it should take less minutes on a multicore.

  4. [the same] After the build finishes, open wxWidgets/samples/minimal/minimal_vc9.sln.

  5. [the same] Let MSVC convert the solution to become an appropriate format.

    8.1. repeat steps 4.2 to 4.4 for the current sample;

  6. [the same] Build and run the sample.

For what is worth, installing SDK 8.1 (either from VS or standalone) made no difference. I guess there must be a bug somewhere but it's not all that obvious.

catalin
  • 1,927
  • 20
  • 20
  • Thank you, I tried your solution and also downloaded SDK 8.1 and both of them worked. – Nbk Aug 17 '17 at 02:03
2

I personally tried the methods mentioned above several times but it failed to build on my VS2017 15.5.2 so I searched and found the best way is that mentioned here, in summary(quote)

  1. Open a "Visual Studio Command Prompt" window shortcut to which must have been installed to the "Start" menu or the "Start" screen by MSVS installation.

  2. Change directory to %WXWIN%\build\msw and type

    > nmake /f makefile.vc
    

    to build wxWidgets in the default debug configuration as a static library. You can also do

    > nmake /f makefile.vc BUILD=release
    

    to build a release version or

    > nmake /f makefile.vc BUILD=release SHARED=1
    

    to build a release DLL version. Finally, you can also add "TARGET_CPU=X64" to nmake command line to build Win64 versions (this only works if you are using a 64 bit compiler, of course).

For x64 build, commands become:

    > nmake /f makefile.vc TARGET_CPU=X64
    > nmake /f makefile.vc BUILD=release TARGET_CPU=X64

See "Configuring the Build" for more information about the additional parameters that can be specified on the command line.

  1. To verify your build, change the directory to samples\minimal and run the same nmake command (with the same parameters there), this should create a working minimal wxWidgets sample.

hope this will help!

Hzine
  • 105
  • 1
  • 9