About lib/vc_lib/mswuwx/setup.h 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
Andy
In need of some credit
In need of some credit
Posts: 8
Joined: Sun Dec 29, 2019 12:18 pm

About lib/vc_lib/mswuwx/setup.h

Post by Andy »

:oops: I use VisualStdio 2015 set the "Hello world"project in the windows system project,but it always exit error C1083 :Cannot open include file: '../../../lib/vc_lib/mswud/wx/setup.h': No such file or directory. Then I do some work according to the solution from online forum. What's worse, it add the erro can't open the source file:H:\wxWidgets\wxWidgets-3.1.2\lib\vc_dll\mswud”: No such file or directory. My version is wxWidgets-3.1.2.I have compiled wxWidgets in windows and run other wxWisdgets project。
What's wrong with me :( ,please tell me the solution!!!!! This is the most difficulty when i learn wxWidgets.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: About lib/vc_lib/mswuwx/setup.h

Post by doublemax »

After you unpacked wxWidgets you need to build the wxWidgets libraries. Go to <wxdir>/build/msw/ and open wx_vc14.sln.
Select "Build Solution" from the "Build" menu. This will build one configuration (debug).
Switch Configuration to "Release" and build again.

Close VS.

Now go to <wxdir>/samples/minimal/ and open "minimal_vc9.vcproj". Let VS convert the project.
"Build Solution" again. Now you can run the "minimal" sample.

This all should work out of the box.
Use the source, Luke!
Andy
In need of some credit
In need of some credit
Posts: 8
Joined: Sun Dec 29, 2019 12:18 pm

Re: About lib/vc_lib/mswuwx/setup.h

Post by Andy »

It still has old problem C1083: Cannot open include file: '../../../lib/vc_lib/mswud/wx/setup.h when I Build Solution from the <wxdir>/samples/minimal/ and open "minimal_vc9.vcproj".
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: About lib/vc_lib/mswuwx/setup.h

Post by doublemax »

This still sounds like you either didn't build the wxWidgets libraries (step 1 from my previous post) or you built a different configuration.
Use the source, Luke!
Andy
In need of some credit
In need of some credit
Posts: 8
Joined: Sun Dec 29, 2019 12:18 pm

Re: About lib/vc_lib/mswuwx/setup.h

Post by Andy »

I build the vc_dll not vc_lib,the erro indicate the vc_Lib/mswud/wx/setup.h
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: About lib/vc_lib/mswuwx/setup.h

Post by doublemax »

Then you either have to re-build wxWidgets itself with the "Debug" configuration, or you need to change the configuration to "Debug DLL" when building the "minimal" sample.
Use the source, Luke!
Andy
In need of some credit
In need of some credit
Posts: 8
Joined: Sun Dec 29, 2019 12:18 pm

Re: About lib/vc_lib/mswuwx/setup.h

Post by Andy »

I use DLL Debug /DLL Release can run the minimal project. Thank you!!! :)But my aims is to build own wxWidgets project .Why there is without DLL Debug /DLL Release in my own project.There is only Debug/Release and it not work. :oops:
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: About lib/vc_lib/mswuwx/setup.h

Post by doublemax »

Building an empty VS studio project with wxWidgets from scratch is not an easy task. A lot of paths, libraries, preprocessor symbols etc. need to be set correctly.

I suggest to copy the "minimal" sample and modify it. As it uses relative paths to find wxWidgets, it won't work out of the box if you copy it to another directory. You need to go through the whole project (in all configurations) and change the relative paths to absolute ones. Or even better to paths that use an environment variable like WXWIN.

For each configuration there are three places where you need to change the path:
C/C++ -> General -> Additional Include Directories
Linker -> General -> Additional Library Directories
Resources -> General -> Additional Include Directories
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: About lib/vc_lib/mswuwx/setup.h

Post by PB »

doublemax wrote: Sun Dec 29, 2019 1:41 pm Building an empty VS studio project with wxWidgets from scratch is not an easy task. A lot of paths, libraries, preprocessor symbols etc. need to be set correctly.
I dare to disagree, it is actually very simple and should be done under five minutes.

The following assumes you have set the WXWIN environment variable correctly, so its value is something like c:\wxwidgets. Obviously, it also expects you built the requested configurations of wxWidgets.

For example, a simple guide below shows a wxWidgets-related MSVS project settings one needs to add for a self-built 32-bit DLL Debug configuration of a wxWidgets app. The titles in bold and italics in sections 1-4 correspond to the Configuration Properties of a project. Section 5 also describes modifications of the project needed for Release, Static build or 64-bit build.

Start with using the "Windows Desktop Wizard" to create a new project (from menu File/New/Project). Select "Desktop Application" as "Application Type" and check "Empty project". Then add at least one C++ file to the project.

1 General
Make sure Character Set is set to "Use Unicode Character Set".

2 C/C++
2.1 General/Additional Include Directories:

Code: Select all

$(WXWIN)\include\msvc; $(WXWIN)\include
2.2 Preprocessor/Preprocessor Definitions:

Code: Select all

__WXMSW__;WXUSINGDLL;_DEBUG
Click on the combobox arrow next to the text edit, choose "<Edit...>" from the menu and in the "Preprocess Definitions" dialog make sure the checkbox "Inherit from parent or project defaults" is checked.

3 Linker
3.1 General/Additional Library Directories:
When you are using a MSVC-specific include (see step 2.1), all necessary libraries are linked automatically and you do not need to list their names, you just need to tell the linker where they are.

Code: Select all

$(WXWIN)\lib\vc_dll
3.2 System
Set SubSystem as follows, otherwise you will get some odd error about the main() function not found

Code: Select all

Windows (/SUBSYSTEM:WINDOWS)
4 Resources
The resources options may become available only once you add an .rc file to your project. You should have one, if only to add the application icon.
4.1 General/Additional Include Directories:

Code: Select all

$(WXWIN)\include
5 Additional tips
5.1 Making the wxWidgets DLLs available
If you use the DLL build, you must make the correct wxWidgets DLLs available to your program. Either copy them to the directory where the executable resides or just for running the app from the MSVS in Debugging set the Environment to

Code: Select all

PATH=$(WXWIN)\lib\vc_dll
5.2 Settings for the Release configuration
In the preprocessor definitions (see step 2.2) replace

Code: Select all

_DEBUG
with

Code: Select all

NDEBUG
5.3 Static build
If you do not want a DLL build, remove this preprocessor definition (see step 2.2)

Code: Select all

WXUSINGDLL
and change the linker's library directory (see step 3.1) to

Code: Select all

$(WXWIN)\lib\vc_lib
5.4 64-bit build
If you built your libraries in vc_x64_{lib|dll} folder, you must use this folder everywhere instead of vc_{lib|dll} folder.

5.5 DPI Awareness
Last but not least, if your application is DPI-aware (it better be in 2020), you should at least set its DPI Awareness in Manifest Tool/Input and Output to "High DPI Aware". But it may be better to include a proper application manifest, with Windows version compatibilities listed and having PerMonitorV2 awareness there. However, PMv2 DPI awareness support is not that good yet in wxWidgets, see e.g. here .

Prebuilt binaries
If you did not build wxWidgets yourself and are using prebuilt binaries for MSVS 2015/2017/2019/2022 you need to set the linker folder (see step 3.1) to

Code: Select all

$(WXWIN)\lib\vc14x_dll
for the 32-bit version or for 64-bit version to

Code: Select all

$(WXWIN)\lib\vc14x_x64_dll
and add preprocessor definition (see step 2.2)

Code: Select all

wxMSVC_VERSION_ABI_COMPAT
as the compiler prefix in the folder name for those is vc14x. But when using prebuilt binaries, you may be better off using the .props method, see the official documentation or my step-by-step guide.

BTW, I expect you read this official guide for setting up wxWidgets apps on MSW?
Bryan Kelly
Earned some good credits
Earned some good credits
Posts: 117
Joined: Wed Apr 27, 2022 10:47 pm

Re: About lib/vc_lib/mswuwx/setup.h

Post by Bryan Kelly »

From the post: by PB » Sun Dec 29, 2019 11:37 pm, in the section titled
2.2 Preprocessor/Preprocessor Definitions
Is the below text:
Click on the combobox arrow next to the text edit, choose "<Edit...>" from the menu and in the "Preprocess Definitions" dialog make sure the checkbox "Inherit from parent or project defaults" is checked.
I am not able to properly read those instructions. I don’t find a “text edit.”
When the line for Preprocessor Definitions is highlighted, there is a drop down arrow display on the right side of that line. When that is clicked, one of the options is: Inherit from parent or project defaults
But, it does not get checked, the user can click on that option and all the text in that line is replaced by the text:
Inherit from parent or project defaults
But this wipes out the text just edited in. So what is the correct setup? What did I miss?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: About lib/vc_lib/mswuwx/setup.h

Post by PB »

Bryan Kelly wrote: Tue May 10, 2022 4:18 am From the post: by PB » Sun Dec 29, 2019 11:37 pm, in the section titled
2.2 Preprocessor/Preprocessor Definitions
Is the below text:
Click on the combobox arrow next to the text edit, choose "<Edit...>" from the menu and in the "Preprocess Definitions" dialog make sure the checkbox "Inherit from parent or project defaults" is checked.
I am not able to properly read those instructions. I don’t find a “text edit.”
By "text edit", I mean the control for typing the text. The below is from MSVS 2022 but IIRC, it has been the same for many MSVS versions (click the picture to see full size animation):
msvs-preprocessor.gif
Inherited properties do not replace the user typed ones in the configuration, they get merged. Make sure you have only one Configuration (e.g., Debug DLL) and Platform (e.g., Win32) selected.
Post Reply