On a Windows 7 virtual machine I set up a C++ build environment using the following:
C:\usr\local\gcc-13.2.0 (from winlibs);
C:\usr\local\cmake-3.27.6 (from KitWare);
C:\usr\local\wxWidgets-184.108.40.206 (sources, from wxwidgets.org);
C:\usr\local\codelite-17.6.0 (from codelite.org),
built wxWidgets in the directory
C:\usr\local\wxWidgets-220.127.116.11\build (directory was there already, seemed the right place), using the
gcc executables above and using
mingw32-make from the compiler directory.
The binaries are in
lib\gcc_x64_dll under the wxWidgets directory, and the names of all the shared libraries end in
Then to build a wxWidgets 'Hello World' example, in CodeLite:
gdb in the same directory
WXCFG=gcc_x64_dll\mswu to "Settings" -> "Environment Variables"
The program builds successfully! However, when I run it, the output in CodeLite is just "Program exited" (no error messages) and no window appears.
When I run it through the debugger, it says
Debugger exited with the following error string: "During startup program exited with code 0xc0000135".
Without other errors and warnings and no call stack available, is it possible to find out what is not working here?
Following advice by @Tsyvarev I have opened the
.exe file in the program Explorer Suite, which shows its dependencies:
libstdc++-6.dll (both in
C:\usr\local\gcc-13.2.0\bin but not found by CFF Explorer);
ucrtbase.dll (both found in
wxmsw32u_xrc_gcc_custom.dll (all three in
C:\usr\local\wxWidgets-18.104.22.168\libgcc_x64_dll but not found by CFF Explorer)
In my "Settings" -> "Global Settings" I have now added
C:\usr\local\wxWidgets-22.214.171.124\lib\gcc_x64_dll; C:\usr\local\gcc-13.2.0\bin; to the "Library Path" and
-lwxbase32u_gcc_custom; -lwxmsw32u_core_gcc_custom; -lwxmsw32u_xrc_gcc_custom; -llibgcc_s_seh-1; -llibstdc++-6 to the "Linker Options". To make the last option work I also need to rename
libstdc++-6.dll.a in the compiler's
lib directory, otherwise the
.a clashes with the
Compilation finishes successfully, program crashes. From the IDE as well as from the shell. The IDE (debugger) gives the "exit code" message and the shell says: "The program cannot start because libgcc_s_seh-1.dll is missing from your computer."
Does anyone know what is needed to be able to use those DLLs both during linking my program and for running it independently?
After putting the two directories
C:\usr\local\gcc-13.2.0\bin (the DLLs of g++) and
C:\usr\local\wxWidgets-126.96.36.199\lib\gcc_x64_dll (the DLLs of wxWidgets) to the path and restarting:
So that finally seems to have done the trick! (though not really sure what happened at "1.")
Will do some more testing and then produce a nice bullet list.
In the end the comments by @Tsyvarev and @Igor helped me find the answer. The issue with building wxWidgets as shared libraries, which is normal in Linux but not in Windows, is that these libraries need to be in the system's (or the user's)
Path environment variable. They could also be copied into every executable's directory, but that would defy the purpose of shared libraries!
So my recipe for building GUIs with wxWidgets in CodeLite in Windows is:
WXCFG to the wxWidgets source directory and the lib//mswu directory, respectively;
Path environment variable so that it includes both the
bin directory of the GCC compiler and the full path of the
WXCFG directory's parent;
In the end, no extra linker options are necessary for building, but if you want to use shared libraries as they were intended, they need to be reachable via the
Path environment variable (there is no
I copied the result of steps 1-2 to another Windows 7 virtual machine and steps 3-5 were enough to get a wxFrame working.