3

I am somewhat of a beginner when it comes to open source libraries. I have tried to compile from source and use the pre-built binaries, but in both cases I get a ton of errors when I try to run the simple 'Hello World' program on the tutorial section of the wxWidgets website. After playing around for quite some time, the closest I have got to compiling is by building the libraries from source, but I still have 2 errors remaining:

  • "_w64 can only be specified on int, long, and pointer types" file: defs.h
  • "cannot open file 'wxbase31ud.lib" - LINK

It seems strange to me that the header file provided by wx would have an error such as that one, so I imagine both errors are because of something I am doing. I am hoping that someone here can do one of the following for me:

  1. Help me solve these errors
  2. Provide instructions for building libraries from source and subsequently linking my program to the correct directories

Some additional info: I am working on x64 Windows 7, my target will also be x64 exclusively. I do not have admin privileges, so no editing the system PATH for me.

Thanks for your help!

m_dubya
  • 111
  • 1
  • 1
  • 7
  • Use the Developer Command Environment and rebuild wxWidgets from the source. Your platform (32-bit/64-bit) must match the wxWidgets libraries in order for you to use them. A lot less headaches to build wxWidgets to suite your development environment. – Thomas Matthews Jun 23 '16 at 15:06

1 Answers1

12

The simplest way to start working with the library is this:

  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.

If you will acquire any issue during those steps, let us know. The library build in step 5 should build without any issues and then all you will need is to build the minimal sample.

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.

[EDIT]

If you can build the 32-bit libraries (which are default in the provided solutions) all you will need is to convert them to be 64-bit and rebuild.

There is no changes to the $PATH or any environmental variable involved. Moreover you shouldn't build anything with the admin priviledges.

Also as Thomas pointed out you library build has to match whatever sample you are trying to build.

[/EDIT]

Igor
  • 5,620
  • 11
  • 51
  • 103
  • Thanks so much... was missing the 'batch' part of build – m_dubya Jun 23 '16 at 17:25
  • If I don't want to copy and edit a sample project to get started on a new project what project properties is it I need to change on a normal empty project to get it to work? Tried adding the include folder for WxWidgets to a new project but still get a lot of errors about missing defines. – David S Jul 21 '16 at 20:45
  • @DavidS, just open a sample project and manually copy properties one by one. – Igor Jul 22 '16 at 14:30
  • @Igor Please finish sentence 7 "After the build finishes, open...". Open what? – aaa90210 Sep 13 '16 at 07:32
  • @Igor, if I could revive this conversation. I am having a similar issue with a new install of wx and plplot w/ VS2017. The wx samples work, the plplot examples work. But the wxPlplotDemo does not. I get a build that does not fail, does not say there are errors in the output window, yet the exe will not run. AND, when I look at the error list I see the same error that is the subject of this Q. Any thoughts? –  Nov 01 '19 at 20:02