Compiling with XP support Topic is solved

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
RobertWebb
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun Oct 29, 2017 11:14 am
Contact:

Compiling with XP support

Post by RobertWebb »

Compile a sample project, say "internat" - works at first.

Change the property "General->Platform Toolset" to "Visual Studio 2015 - Windows XP (v140_xp)" (using Visual Studio 2015), to include XP support.

Build any configuration (Debug/Release, DLL/static) - fails.

Now I get the error:

Code: Select all

LINK : fatal error LNK1104: cannot open file 'winmm.lib'
Why? How can changing this make it stop finding a standard Windows library that's not part of wx?


I tried recompiling wxWidgets itself with this setting too.
  • The static libraries compile fine, but it doesn't help with the above error when compiling other projects using wxWidgets.
  • DLLs don't compile. At first we get lots of this error:

    Code: Select all

    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(1193,5): warning MSB8030: The linker switch "Minimum Required Version" requires "SubSystem" to be set.  Without "SubSystem", the "Minimum Required Version" would not be passed to linker and could prevent to the output binary from running on older Operating Systems.
    This is fixed in the properties by setting "Linker->System->SubSystem" to "Windows (/SUBSYSTEM:WINDOWS)".
    But then we get a similar error to above:

    Code: Select all

    LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
So how do I get this to work? And for that matter, is this even necessary to get XP support? (I can't easily test this anywhere right now).

I'm using wxWidgets 3.0.3.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Compiling with XP support

Post by PB »

Out of curiousity, I tried this and could build everything as expected. Did not have time to check if the program actually runs on Windows XP.

What I did:
* Downloaded and extracted wxWidgets-3.0.3.7z
* Launched MSVS, opened build\msw\wx_vc12.sln and let the IDE convert the solution to vc14
* Chose DLL Debug configuration
* Selected ALL projects in Solution Explorer and set their platform toolset to "Visual Studio 2015 - Windows XP (v140_xp)"
* Built the library successfully
* Launched MSVS, opened samples\widgets_vc9.vcproj and let the IDE convert the solution
* Chose DLL Debug configuration
* Set the platform toolset for the project to "Visual Studio 2015 - Windows XP (v140_xp)"
* Built the sample successfully

Microsoft Visual Studio Express 2015 for Windows Desktop
Version 14.0.25431.01 Update 3
User avatar
RobertWebb
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun Oct 29, 2017 11:14 am
Contact:

Re: Compiling with XP support

Post by RobertWebb »

PB wrote:Out of curiousity, I tried this and could build everything as expected
Thanks for trying this. I just tried exactly the same thing with different results.
What I did:
* Downloaded and extracted wxWidgets-3.0.3.7z
* Launched MSVS, opened build\msw\wx_vc12.sln and let the IDE convert the solution to vc14
* Chose DLL Debug configuration
* Selected ALL projects in Solution Explorer and set their platform toolset to "Visual Studio 2015 - Windows XP (v140_xp)"
* Built the library successfully
At this point we diverge. For me it doesn't build successfully. I hit F7 more than 5 times, but same 16 errors every time, all of the same form. For example, the first 3 lines of output:

Code: Select all

1>------ Build started: Project: base, Configuration: DLL Debug Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(1193,5): warning MSB8030: The linker switch "Minimum Required Version" requires "SubSystem" to be set.  Without "SubSystem", the "Minimum Required Version" would not be passed to linker and could prevent to the output binary from running on older Operating Systems.
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
Did you get those "Minimum Required Version" warnings? Looks like they're only warnings so it may still compile with those, but not being able to find standard Windows libraries is the real issue.

I'm using Microsoft Visual Studio Community 2015, Version 14.0.25123.00 Update 2. Slightly different but I doubt it could affect this.

I've spent days trying to solve these frustrating administrative issues with wxWidgets, but nothing's making sense. Now the internat sample project is giving the "LINK : fatal error LNK1104: cannot open file 'winmm.lib'" error even when I change the platform toolset back to its original setting, argh! Previously changing this would reliably switch it between working and not working. I have no idea what's going on.
User avatar
RobertWebb
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun Oct 29, 2017 11:14 am
Contact:

Re: Compiling with XP support

Post by RobertWebb »

By the way, all this is with 32-bit builds, not 64-bit.
User avatar
RobertWebb
Earned a small fee
Earned a small fee
Posts: 23
Joined: Sun Oct 29, 2017 11:14 am
Contact:

Re: Compiling with XP support

Post by RobertWebb »

I solved it! Turns out it was because I once used Visual Leak Detector years ago :shock:

The project inherited include/library paths from Visual Leak Detector which seemed harmless enough, but were somehow causing all the problems. Had to go to "View->Property Manager", expand a project configuration, double click on "Microsoft.Cpp.Win32.user" and for every property in bold in any of the sections, select "<Inherit from parent or project defaults>" from the drop-down.

This fixed all the linking errors.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Compiling with XP support

Post by PB »

Sorry, I have missed those subsystem warnings. When I tried again, I got them which means the code linked fine but it probably would not run on Windows XP.

So in addition to what I described in my previous post, I set SubSystem to "Windows (/SUBSYSTEM:WINDOWS)" and Minimum Required Version to "5.01" in all the applicable projects for wxWidgets library as well as in the widgets sample. The resulting executable could be run on Windows XP (Windows 7's Windows XP Mode)
Post Reply