Not able to configure wxwidgets 3.1.3 on VS 2017 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
va6un
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 13, 2020 10:25 am

Not able to configure wxwidgets 3.1.3 on VS 2017

Post by va6un » Fri Mar 13, 2020 10:43 am

I am not able to configure wxwidgets in Visual Studio 2017.

Followed these steps.
  • From wxwidgets website, downloaded Source Code 'Windows 7Z' file, Version 3.1.3.
  • Run the 'wx_vc15.sln' from build->msw in Visual Studio 2017.
  • Build the Debub, DLL Debug, DLL Release, Relese successfully with Platform x86.
Followed this link https://www.wxwidgets.org/blog/2012/08/ ... -binaries/ to configure wxwidgets.
  • Set new variable wxwin Environment Variables and set it's value to C:\Users\varun\Desktop\workspace\wxWidgets-3.1.3
  • The Microsoft Visual Studio 17 Version I'm using is 15.9.20. Created an empty project and added new C++ file
To configure, in Project Properties
  • Set Configuration -> All Configurations and Platform -> Active(win32)
  • C/C++
    • Additional Include Directories -> $(wxwin)/include/msvc;$(wxwin)/include
  • Preprocessor
    • Preprocessor Defenitions -> WXUSINGDLL; wxMSVC_VERSION_AUTO
  • Linker
    • Additional Library Directories -> $(wxwin)\lib\vc_dll
Copy the Hello World example from https://docs.wxwidgets.org/stable/overv ... world.html


But these errors are displayed
  • cannot open source file "../../../lib/vc141_dll/mswd/wx/setup.h"
  • unknown attribute "no_init_all"
  • etc.

Kvaz1r
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 216
Joined: Tue Jun 07, 2016 1:07 pm

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by Kvaz1r » Fri Mar 13, 2020 11:26 am

First of all try build and run minimal sample from samples folder to check have your built the library right. if sample works - just copy settings from there.

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

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by doublemax » Fri Mar 13, 2020 12:04 pm

Linker
Additional Library Directories -> $(wxwin)\lib\vc_dll
cannot open source file "../../../lib/vc141_dll/mswd/wx/setup.h"
Notice the difference.

In general it's easier to take the minimal sample and its project files and copy it instead of creating a new VS solution from scratch. There are many thing you can do wrong when doing it manually.
Use the source, Luke!

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

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by PB » Fri Mar 13, 2020 3:17 pm

I would say you need to remove wxMSVC_VERSION_AUTO from the project's preprocessor defines, see
https://docs.wxwidgets.org/trunk/page_c ... vc_setup_h

Seeing "mswd" instead of "mswud" in the library path indicates that you also did not set Character Set to "Use Unicode Character Set" in the project settings.

And as always, I disagree with doublemax about copying the minimal sample project which uses relative paths to wxWidgets instead of the officially recommended WXWIN nor does not use the recommended setup for MSVC.

Setting up wxWidgets project is easy, as long as you understand how C++ works and can read the official docs, see e.g. here
viewtopic.php?f=19&t=46700#p196105

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4245
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by ONEEYEMAN » Fri Mar 13, 2020 4:34 pm

PB,
Copying the minimal (or any other sample) was the recommended way to start a project for a long time.
Currently with an additiopn of .props file the process becomes very easy.

Thank you.

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

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by PB » Fri Mar 13, 2020 4:50 pm

ONEEYEMAN wrote:
Fri Mar 13, 2020 4:34 pm
Copying the minimal (or any other sample) was the recommended way to start a project for a long time.
Currently with an additiopn of .props file the process becomes very easy.
Times change...

Using .props does not work with official binary distribution so I hesitate to recommend it, even when people build wxWidgets on their own. I understand that such hesitance may look silly.

User avatar
va6un
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 13, 2020 10:25 am

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by va6un » Sat Mar 14, 2020 10:10 am

I made mistake while setting the path, corrected the '/' with '\'.
Tried a simple program from
http://zetcode.com/gui/wxwidgets/firstprograms/

This time no code error is shown. But Linker Tools Error.
  • Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" ([email protected]@YAHXZ) WxWidgets_Application_3 C:\Users\varun\Desktop\workspace\visual_studio_projects_2017\WxWidgets_Application_3\WxWidgets_Application_3\MSVCRTD.lib(exe_main.obj)
  • Error LNK1120 1 unresolved externals WxWidgets_Application_3 C:\Users\varun\Desktop\workspace\visual_studio_projects_2017\WxWidgets_Application_3\Debug\WxWidgets_Application_3.exe

User avatar
va6un
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 13, 2020 10:25 am

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by va6un » Sat Mar 14, 2020 10:12 am

doublemax wrote:
Fri Mar 13, 2020 12:04 pm
Linker
Additional Library Directories -> $(wxwin)\lib\vc_dll
cannot open source file "../../../lib/vc141_dll/mswd/wx/setup.h"
Notice the difference.

In general it's easier to take the minimal sample and its project files and copy it instead of creating a new VS solution from scratch. There are many thing you can do wrong when doing it manually.
Yes. I corrected those. And tried with simple program. But Linker issues.

User avatar
va6un
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 13, 2020 10:25 am

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by va6un » Sat Mar 14, 2020 10:13 am

PB wrote:
Fri Mar 13, 2020 3:17 pm
I would say you need to remove wxMSVC_VERSION_AUTO from the project's preprocessor defines, see
https://docs.wxwidgets.org/trunk/page_c ... vc_setup_h

Seeing "mswd" instead of "mswud" in the library path indicates that you also did not set Character Set to "Use Unicode Character Set" in the project settings.

And as always, I disagree with doublemax about copying the minimal sample project which uses relative paths to wxWidgets instead of the officially recommended WXWIN nor does not use the recommended setup for MSVC.

Setting up wxWidgets project is easy, as long as you understand how C++ works and can read the official docs, see e.g. here
viewtopic.php?f=19&t=46700#p196105
The links where super helpful =D>

User avatar
va6un
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Mar 13, 2020 10:25 am

Re: Not able to configure wxwidgets 3.1.3 on VS 2017

Post by va6un » Sun Mar 15, 2020 5:15 pm

Solved.
In Project Configurations -> Linker -> System -> SubSystem -> Windows (/SUBSYSTEM:WINDOWS).
Previously it was set as Console (/SUBSYSTEM:CONSOLE)
The link to SO https://stackoverflow.com/a/60693124/11566024

Post Reply