which are the correct Visual Studio compiling instructions?

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu May 26, 2016 9:19 pm

which are the correct Visual Studio compiling instructions?

Post by bsenftner » Mon Apr 13, 2020 11:02 pm

I'm trying to compile static libs for version 3.1.3, yet going through multiple compile guides, I am not finding success. Every compile guide is either old, or produces the wrong libraries. The instructions included in the download at wxWidgets-3.1.3/docs/msw/install.md are unclear or wrong. Following those instruction to create a static debug produces a dll debug build, or an incorrectly configured build because the libs end up in lib\vc_lib and not lib\vc_x64_lib. Then trying to use the build throws an include error because (for some reason) the C compiler's Include handling also has link include references that fail looking for the vc_x64_lib directory.

Trying to compile directly from the VS IDE: loading the Visual Studio solution for my version (VS 2015), it looks like the solution is configured for static or dll builds - however, the "static" configuration is actually set for dll builds - so I'm left scratching my head wondering if I missed some configuration step or what guide am I supposed to be using... Do I need to step through every project in the solution and interactively set the compile properties to build a static library? Why was the VS Solution not saved that way? Something is f'ed up...

User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu May 26, 2016 9:19 pm

Re: which are the correct Visual Studio compiling instructions?

Post by bsenftner » Tue Apr 14, 2020 12:19 am

Never mind. I don't know why, but my dumb ass missed the "TARGET_CPU=X64" bit after staring right at it far too many times.

User avatar
doublemax
Moderator
Moderator
Posts: 15264
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: which are the correct Visual Studio compiling instructions?

Post by doublemax » Tue Apr 14, 2020 2:16 am

a) For the future: The most important piece of information was missing in your post, the exact command line you used.

b) Regarding the VS project files: I'm pretty sure they are correct. What you're probably mixing up is linking wxWidgets statically vs. linking the CRTs statically. All project files (bothing for linking wxWidgets statically *and* as DLLs) use dynamic linking for the CRTs, that's why you see "Multi-threaded [Debug] DLL" in the compiler settings. And if you ever have to change any setting like this, you don't have to do it for every project individually, you can select multiple at once and then make your changes.
Use the source, Luke!

User avatar
bsenftner
Experienced Solver
Experienced Solver
Posts: 74
Joined: Thu May 26, 2016 9:19 pm

Re: which are the correct Visual Studio compiling instructions?

Post by bsenftner » Tue May 05, 2020 5:55 pm

For what it's worth, I've downloaded fresh copies and recompiled wxWidgets a number of times in the last few days, and the Visual Studio projects/solutions are definitely not setup correct. To insure correct compiles for a static library build, every single project (except "_custom_build") needs to have each configuration (Debug, Release) and each desired target (X64, Win32) Properties visited and the "Code Generation" section corrected away from a Multi-Threaded DLL build to a Multi-Threaded build.

There was also some issue with manually needing to copy a setup.h file from one location to another. That's only mentioned in the FAQ for IDE forums, as far as I can tell. viewtopic.php?f=19&t=255

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2662
Joined: Sun Jan 03, 2010 5:45 pm

Re: which are the correct Visual Studio compiling instructions?

Post by PB » Tue May 05, 2020 6:50 pm

bsenftner wrote:
Tue May 05, 2020 5:55 pm
For what it's worth, I've downloaded fresh copies and recompiled wxWidgets a number of times in the last few days, and the Visual Studio projects/solutions are definitely not setup correct. To insure correct compiles for a static library build,....
No one claims MSVS solutions come with a preset configuration for linking the CRT statically. Linking the CRT statically, while perhaps sometimes convenient, is not recommended for several reasons and there is way too many configurations in those solutions already.

Anyway, one can very easily build static configurations with provided CMake or NMake make files, without modifying any provided files.
bsenftner wrote:
Tue May 05, 2020 5:55 pm
There was also some issue with manually needing to copy a setup.h file from one location to another.
I believe there is never a need to copy setup.h anywhere. If the compiler complains about missing setup.h, it means you did not set its include paths properly and working around it by copying the file may lead to further issues.

Post Reply