GUI not opening in project compiled with MSVC

55 views
Skip to first unread message

Sean

unread,
Jun 28, 2021, 10:36:17 AM6/28/21
to wx-users
Hello to everyone,

I'm trying to compile a simple wxWidgets project with MSVC. I don't use
Visual Studio (GUI), I compile with CL in console. I actually use Scons
but that's off topic.
I am not getting any compilation errors. The project is compiling. But
the executable file does not open. So I can't see the GUI.
There are no errors.
When I compile the same project with MinGW there is no problem. Same
code and same project.
I got the build parameters from the samples in the samples folder. I
modified them for my own project.

Here are the cl and linker commands:
```cmd
cl /FoShutdownTimer.obj /c ShutdownTimer.cpp /MT /DWIN32 /O2
/D_CRT_SECURE_NO_DEPRECATE=1 /D_CRT_NON_CONFORMING_SWPRINTFS=1
/D_SCL_SECURE_NO_WARNINGS=1 /D__NO_VC_CRTDBG__ /D__WXMSW__ /DNDEBUG
/D_UNICODE /Ilib\vc_x64_lib\mswu /Iinclude /I. /W4 /D_WINDOWS /DNOPCH
/GR /EHsc /nologo ShutdownTimer.cpp
ShutdownTimer.cpp(142): warning C4100: 'event': unreferenced formal
parameter
rc /d WIN32 /d _CRT_SECURE_NO_DEPRECATE=1 /d
_CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 /d
__NO_VC_CRTDBG__ /d __WXMSW__ /d NDEBUG /d _UNICODE /i
lib\vc_x64_lib\mswu /i include /i . /d _WINDOWS /d NOPCH /fost.res st.rc
link /OUT:ShutdownTimer.exe ShutdownTimer.obj /NOLOGO /opt:ref /opt:icf
/MACHINE:X64 /MANIFEST:EMBED
/MANIFESTINPUT:include/wx/msw/amd64_dpi_aware_pmv2.manifest /LIBPATH:lib
wxmsw31u.lib wxscintilla.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib
wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib
oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib
wininet.lib oleacc.libuxtheme.lib
```

Folder layout:
* include
* lib - MONOLITHIC=1 shared=0 BUILD=release
* Shutdowntimer.cpp - main application
* st.rc - resource file taken from the minimal example.

I am sharing code and res file with paste.ubuntu.
English is not my native language. I may have chosen the wrong words. If
you want more details I will share them.

ShutdownTimer.cpp: https://paste.ubuntu.com/p/D2xDqcbb4W/
resource file: https://paste.ubuntu.com/p/8qhnQQmdT2/

Some details:
* Visual studio 2019
* windows 10 64-bit
* wx version: 3.0.5
* libraries and compiler set for 64bit

Thanks

Igor Korot

unread,
Jun 28, 2021, 12:22:55 PM6/28/21
to wx-u...@googlegroups.com
Hi,



On Mon, Jun 28, 2021, 7:36 AM Sean <s.tolst...@gmail.com> wrote:
Hello to everyone,

I'm trying to compile a simple wxWidgets project with MSVC. I don't use
Visual Studio (GUI), I compile with CL in console. I actually use Scons
but that's off topic.
I am not getting any compilation errors. The project is compiling. But
the executable file does not open. So I can't see the GUI.
There are no errors.
When I compile the same project with MinGW there is no problem. Same
code and same project.
I got the build parameters from the samples in the samples folder. I
modified them for my own project.

Are you able to build and run "minimal" sample?


Here are the cl and linker commands:
```cmd
cl /FoShutdownTimer.obj /c ShutdownTimer.cpp /MT /DWIN32 /O2
/D_CRT_SECURE_NO_DEPRECATE=1 /D_CRT_NON_CONFORMING_SWPRINTFS=1
/D_SCL_SECURE_NO_WARNINGS=1 /D__NO_VC_CRTDBG__ /D__WXMSW__ /DNDEBUG
/D_UNICODE /Ilib\vc_x64_lib\mswu /Iinclude /I. /W4 /D_WINDOWS /DNOPCH
/GR /EHsc /nologo ShutdownTimer.cpp
ShutdownTimer.cpp(142): warning C4100: 'event': unreferenced formal
parameter
rc /d WIN32 /d _CRT_SECURE_NO_DEPRECATE=1 /d
_CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 /d
__NO_VC_CRTDBG__ /d __WXMSW__ /d NDEBUG /d _UNICODE /i
lib\vc_x64_lib\mswu /i include /i . /d _WINDOWS /d NOPCH /fost.res st.rc
link /OUT:ShutdownTimer.exe ShutdownTimer.obj /NOLOGO /opt:ref /opt:icf
/MACHINE:X64 /MANIFEST:EMBED
/MANIFESTINPUT:include/wx/msw/amd64_dpi_aware_pmv2.manifest /LIBPATH:lib
wxmsw31u.lib wxscintilla.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib
wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib
oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib
wininet.lib oleacc.libuxtheme.lib
```

Folder layout:
* include
* lib - MONOLITHIC=1 shared=0 BUILD=release

Are you absolutely have to use MONOLITHIC build?
What happen if you build the debug version of everything?

Thank you.

* Shutdowntimer.cpp - main application
* st.rc - resource file taken from the minimal example.

I am sharing code and res file with paste.ubuntu.
English is not my native language. I may have chosen the wrong words. If
you want more details I will share them.

ShutdownTimer.cpp: https://paste.ubuntu.com/p/D2xDqcbb4W/
resource file: https://paste.ubuntu.com/p/8qhnQQmdT2/

Some details:
* Visual studio 2019
* windows 10 64-bit
* wx version: 3.0.5
* libraries and compiler set for 64bit

Thanks

--
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/d16e6b04-9168-c45e-beee-c5244845e6ca%40gmail.com.

PB

unread,
Jun 28, 2021, 1:27:16 PM6/28/21
to wx-users
Hi,

you are saying you are using wxWidgets 3.0.5 yet your command line indicates 3.1 (wxmsw31u.lib). You did not provide information about how are your include and library paths set. Please post also the actual full build log .

Generally, an executable not launching usually indicates missing/incompatible DLLs but you say you link to wxWidgets statically and your program does not use any other library, so...

How are you launching the executable: From the command line or from the File Explorer? AFAIK, File Explorer will tell if there is an issue with the program (missing/incompatible DLLs or crash) but the command processor does not.

Regards,
PB
Reply all
Reply to author
Forward
0 new messages