Page 1 of 1

Problem porting to Windows

Posted: Tue Aug 23, 2016 6:30 am
by wittend
I have been having some difficulty with a project I have ported from Linux 14.04 to Windows 7.1. In both cases I am using a private build of wxWidgets 3.1.On Linux everything is fine. On Windows, using Codelite 9.1 my project builds without incident (lots of warnings from the TDM compiler, mostly deprecations in the libs), but when I do a Release->Run a terminal window pops up even though the project is marked as a GUI project. The program runs properly in every way, but when I do File->Exit or System->Close, I get the Windows error message "Program.exe has stopped working" and have to select "Close the Program" to exit.

I cannot seem to find any settings to get Codelite to do a degug build (though I am using customized settings to do the Release build just fine). So I have used wxMessageBoxes and systematic exclusion of code with comments to narrow down the source of the behavior to one of two instances of a grid control. In one case it behaves correctly, in another it behaves on shutdown as if pointers are not getting cleaned up. I cannot see a meaningful difference in the two bits of code.

But what really bothers me is the terminal window that pops up behind the app's window. Even if I take the executable and move it into its own folder and put the wxmsw310u_gcc_cl.dll with it and execute it, I get the terminal window. All I can think of is that there is some problem in my build of wxWidgets. I followed the instructions from the CodeLite Wiki...

The code back ports to Linux without any issue.

The Build log looks like this:

Code: Select all

C:\Windows\system32\cmd.exe /C D:/bin/TDM-GCC-64/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ ttrack - Release ]----------"
'--wxcfg' is not recognized as an internal or external command,
operable program or batch file.
mingw32-make.exe[1]: Entering directory 'D:/Projects/ttrack'
D:/bin/TDM-GCC-64/bin/windres.exe -i "D:/Projects/ttrack/win_resources.rc" --use-temp-file --define __WXMSW__ --define _UNICODE --include-dir D:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu --include-dir D:\Projects\wxWidgets-3.1.0/include --define WXUSINGDLL    -o ./Release/win_resources.rc.o
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/main.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/main.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/MainFrame.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/MainFrame.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/wxcrafter.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/wxcrafter.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/wxcrafter_bitmaps.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/wxcrafter_bitmaps.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/plot.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/plot.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/spectrum-plot.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/spectrum-plot.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/waterfall-plot.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/waterfall-plot.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/windres.exe: warning: 24: 1: 1033: duplicate value
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/geoCtrlBase.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/geoCtrlBase.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/sats_in_view.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/sats_in_view.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/jsonreader.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/jsonreader.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/jsonval.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/jsonval.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/jsonwriter.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/jsonwriter.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/libawx-0.9/src/led.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/libawx-0.9_src_led.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/wxHexCtrl/Tag.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/wxHexCtrl_Tag.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/wxHexCtrl/TagDialogGui.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/wxHexCtrl_TagDialogGui.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe  -c  "D:/Projects/ttrack/wxHexCtrl/wxHexCtrl.cpp" -w -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -ID:\Projects\wxWidgets-3.1.0/lib/gcc_dll/mswu -ID:\Projects\wxWidgets-3.1.0/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport -std=c++11   -DSVN_REVISION=\"\"  -DNDEBUG  -o ./Release/wxHexCtrl_wxHexCtrl.cpp.o -I. -I.. -ID:\Projects\wxWidgets-3.1.0\lib\gcc_dll/mswu
D:/bin/TDM-GCC-64/bin/g++.exe -o ./Release/ttrack @"ttrack.txt" -L. -L. -L.. -LD:\Projects\wxWidgets-3.1.0/lib/gcc_dll  -lwxexpat -lwxjpeg -lwxmsw31u -lwxmsw31u_gl -lwxpng -lwxregexu -lwxscintilla -lwxtiff -lwxzlib -lwxmsw310u_gcc_cl -lwxmsw310u_gl_gcc_cl -lsndfile-1
mingw32-make.exe[1]: Leaving directory 'D:/Projects/ttrack'
====0 errors, 0 warnings, total time: 00:00:11 seconds====

Re: Problem porting to Windows

Posted: Wed Aug 24, 2016 6:49 pm
by eranif
Your program probably crashed... this is why you get the dialog from Windows.
The "cmd" console is shown because:
* The program is marked for "Pause when execution ends" in Project settings->general page
* You should pass "-mwindows" to the linker in project settings->linker->linker options

To build a debug build, just select the "Debug" configuration in drop down at the top of the workspace view.
If you don't have one, create one from: Build->Configuration Manager

by default, CodeLite creates Release and Debug configurations, so you should have one

Eran

Re: Problem porting to Windows

Posted: Wed Aug 24, 2016 8:59 pm
by wittend
Thanks for your patience.

Regarding your comments:
Your program probably crashed... this is why you get the dialog from Windows.
Yeah, I get that. I'm not sure why, however. Probably I'm missing something obvious. For a while I thought I could identify a small block of code that when commented out of my project, eliminated the crash . I just don't see any problem in the code. And now the problem seems to move around. Commenting out what I thought was the offending code no longer helps. The program works fine in every other way. It only crashes on exit. That usually indicates something more fundamental in my experience.

I was really writing because of the latter issue, which I thought might be related in some non-obvious way.
The "cmd" console is shown because:
* The program is marked for "Pause when execution ends" in Project settings->general page
No, it is not. I have tried setting both this option and the related one (is GUI program) in all possible combinations.
I'm not sure how to attach a screen-grab to prove it.
* You should pass "-mwindows" to the linker in project settings->linker->linker options
This is the kind of thing I was looking for, but changing it does not seem to have any effect.
Should I do it like this?:
$(shell --wxcfg=gcc_dll/mswu --prefix=D:\Projects\wxWidgets-3.1.0 --libs --mwindows)
Strike this. I found the setting in the linker popup "Prevent the useless console window..." that WAS new to me. It fixed *that* major irritation.
To build a debug build, just select the "Debug" configuration in drop down at the top of the workspace view.
If you don't have one, create one from: Build->Configuration Manager

by default, CodeLite creates Release and Debug configurations, so you should have one
It does create a debug project but it does not let me override the settings (as I do in Release) to point it at the correct compiler and copy of gdb . It just goes ahead and uses defaults, which point at locations that do not exist.
For another day...

Thanks again,

Dave

Re: Problem porting to Windows

Posted: Fri Aug 26, 2016 2:13 pm
by eranif
I am not sure I am following the latter comment.
Can you please post the build log when building the Debug configuration?

Eran

Re: Problem porting to Windows

Posted: Fri Aug 26, 2016 5:15 pm
by wittend
Thanks for the reply.

Alternate paths to executables entered manually via the Project->settings page seem to be ignored. Only for debug. Release respects my settings (see previous logs).

No time to provide more details, plane to catch, back in 2 Weeks. Have to leave it until then.

Thanks

Dave

Re: Problem porting to Windows

Posted: Fri Aug 26, 2016 6:41 pm
by eranif
wittend wrote:No time to provide more details, plane to catch, back in 2 Weeks
Have a nice trip :)

I just came back from my 2 weeks vacation

Eran