For both projects, this ist set to "GUI application".
By the way: here are the .cbp-files...
Test-project (producing monolithic exe):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="test" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="bin/Release_x86/test" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release_x86/" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectCompilerOptionsRelation="0" />
<Option projectLinkerOptionsRelation="0" />
<Compiler>
<Add option="-fomit-frame-pointer" />
<Add option="-O3" />
<Add option="-D__WXMSW__" />
<Add option="-D__GNUWIN32__" />
<Add option="-D_UNICODE" />
<Add directory="../../../wxWidgets-3.1.2/lib/gcc730_dll/mswu" />
<Add directory="../../../wxWidgets-3.1.2/include" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="../../../wxWidgets-3.1.2/lib/gcc730_dll/libwxmsw31u_core.a" />
<Add library="../../../wxWidgets-3.1.2/lib/gcc730_dll/libwxbase31u.a" />
<Add directory="../../../wxWidgets-3.1.2/lib/gcc730_dll" />
</Linker>
</Target>
</Build>
<Unit filename="../../../Libraries/glew-2.1.0/src/glew.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
Real project (producing dll-exe):
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="glLive3d" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="glLive3d/glLive3d" prefix_auto="1" extension_auto="1" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectCompilerOptionsRelation="0" />
<Option projectLinkerOptionsRelation="0" />
<Compiler>
<Add option="-fomit-frame-pointer" />
<Add option="-O3" />
<Add option="-D__WXMSW__" />
<Add option="-D__GNUWIN32__" />
<Add option="-D_UNICODE" />
<Add directory="../../../wxWidgets-3.1.2/lib/gcc730_dll/mswu" />
<Add directory="../../../wxWidgets-3.1.2/include" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="../../../wxWidgets-3.1.2/lib/gcc730_dll/libwxmsw31u_core.a" />
<Add library="../../../wxWidgets-3.1.2/lib/gcc730_dll/libwxbase31u.a" />
<Add directory="../../../wxWidgets-3.1.2/lib/gcc730_dll" />
</Linker>
</Target>
</Build>
<Unit filename="../../Libraries/glew-2.1.0/src/glew.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="_Controls.cpp" />
<Unit filename="_Controls.h" />
<Unit filename="_Fnc3d.cpp" />
<Unit filename="_Fnc3d.h" />
<Unit filename="_Macros.cpp" />
<Unit filename="_Macros.h" />
<Unit filename="_Main.cpp" />
<Unit filename="_Main.h" />
<Unit filename="_Midi.cpp" />
<Unit filename="_Midi.h" />
<Unit filename="_Modules.cpp" />
<Unit filename="_Modules.h" />
<Unit filename="clsMainWin.cpp" />
<Unit filename="clsMainWin.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
And here are the linker-call as reported while colpiliation (some flags are set for testing):
Test-project (producing monolithic exe):
g++.exe -L..\..\..\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\CodeBlocks\mingw32\mingw\lib -LF:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\Libraries\glfw-3.2.1.bin.WIN32\lib-mingw-w64 -o bin\Release_x86\test.exe obj\Release_x86\Libraries\glew-2.1.0\src\glew.o "obj\Release_x86\Projects\19-01-26 - test-ogl\test\main.o" -s -static-libstdc++ -static-libgcc -static -m32 -mwindows -lwxbase31u -lwxbase31u_net -lwxmsw31u_core -lwxmsw31u_gl -lwxmsw31u_webview -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -flinker-output=exec -no-pie F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxbase31u.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxbase31u_net.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxmsw31u_core.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxmsw31u_gl.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxmsw31u_webview.a -mwindows
Real project (producing dll-exe):
g++.exe -L..\..\..\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\CodeBlocks\mingw32\mingw\lib -LF:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\Libraries\glfw-3.2.1.bin.WIN32\lib-mingw-w64 -o glLive3d\glLive3d.exe .objs\Libraries\glew-2.1.0\src\glew.o ".objs\Projects\19-01-24 - ThreadTest\_Controls.o" ".objs\Projects\19-01-24 - ThreadTest\_Fnc3d.o" ".objs\Projects\19-01-24 - ThreadTest\_Macros.o" ".objs\Projects\19-01-24 - ThreadTest\_Main.o" ".objs\Projects\19-01-24 - ThreadTest\_Midi.o" ".objs\Projects\19-01-24 - ThreadTest\_Modules.o" ".objs\Projects\19-01-24 - ThreadTest\clsMainWin.o" -s -static-libstdc++ -static-libgcc -static -m32 -mwindows -lwxbase31u -lwxbase31u_net -lwxmsw31u_core -lwxmsw31u_gl -lwxmsw31u_webview -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -flinker-output=exec -no-pie F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxbase31u.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxbase31u_net.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxmsw31u_core.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxmsw31u_gl.a F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll\libwxmsw31u_webview.a -mwindows
Sorry, this are the correct linker-call as reported while colpiliation (the others contined redundant duplicate librarie-links):
g++.exe -L..\..\..\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\CodeBlocks\mingw32\mingw\lib -LF:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\Libraries\glfw-3.2.1.bin.WIN32\lib-mingw-w64 -o bin\Release_x86\test.exe obj\Release_x86\Libraries\glew-2.1.0\src\glew.o "obj\Release_x86\Projects\19-01-26 - test-ogl\test\main.o" -s -static-libstdc++ -static-libgcc -static -m32 -mwindows -lwxbase31u -lwxbase31u_net -lwxmsw31u_core -lwxmsw31u_gl -lwxmsw31u_webview -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -flinker-output=exec -no-pie -mwindows
g++.exe -L..\..\..\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\CodeBlocks\mingw32\mingw\lib -LF:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\lib\gcc730_dll -LF:\codeblocks-17.12-nosetup\Libraries\glfw-3.2.1.bin.WIN32\lib-mingw-w64 -o glLive3d\glLive3d.exe .objs\Libraries\glew-2.1.0\src\glew.o ".objs\Projects\19-01-24 - ThreadTest\_Controls.o" ".objs\Projects\19-01-24 - ThreadTest\_Fnc3d.o" ".objs\Projects\19-01-24 - ThreadTest\_Macros.o" ".objs\Projects\19-01-24 - ThreadTest\_Main.o" ".objs\Projects\19-01-24 - ThreadTest\_Midi.o" ".objs\Projects\19-01-24 - ThreadTest\_Modules.o" ".objs\Projects\19-01-24 - ThreadTest\clsMainWin.o" -s -static-libstdc++ -static-libgcc -static -m32 -mwindows -lwxbase31u -lwxbase31u_net -lwxmsw31u_core -lwxmsw31u_gl -lwxmsw31u_webview -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -flinker-output=exec -no-pie -mwindows
If you start your program from within codeblocks, codeblocks adds all library paths to the "PATH" environment variable, so your executable can find them. This does not mean they are linked statically. Codeblocks only makes sure your application can find the dll files.
If you run the application outside of codeblocks the PATH variable is not modified and so your application can not find the library and will report an error.
To compile wxWidgets from source as a static library:
1) download the MSW source from wxWidgets and extract it
2) Make sure your mingw compiler is in the PATH variable: open a cmd window and type
this should not report an error
3) With the command prompt cd to the wxWidgetsSourceCode/build/msw folder
4) run
mignw32-make.exe -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=1
and
mignw32-make.exe -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1
But why do you need static executables? Copy the dll in the same folder as your exe and ship them together...
When i started C::B it always automaticly serched for a compiler and took the first one it found. This was my old MingW-setup with devC++. To avoid this, i've ziped the old MingW. So it can't be found anymore. But this is no real solution. Is there a possibility to stop this auto-search?
you probably have to set one default compiler with the default button... And make sure codeblocks can write the configuration fle: Are other settings saved?
I would be happy to know more about this: "Make sure your mingw compiler is in the PATH variable"...
Just foud out what you ment. Found your post when i wanted to give an update. My head had been at the compiler-settings. So i did not think of system parameter.
Think i understood the principal (long time ago that i used console).
I am confused... Didn't you say that both programs behave the same now, after you cleaned up everything?
I thought i've said that i deleted the folders and recompiled again. Since i did this, both programs behave different again, when i start with C::B-start-button.
I'm also confused (just tried it once more), but ist true...
For example:
1) Compiler Prog1 with project file with Build->Build
...
Yes. Just tried it once more. Ist true...
C::B-Protocol test-program (last line of compilation and program-start)
Output file is bin\Release_x86\test.exe with size 1,05 MB
Process terminated with status 0 (0 minute(s), 6 second(s))
0 error(s), 0 warning(s) (0 minute(s), 6 second(s))
-------------- Run: Release in test (compiler: GNU GCC Compiler)---------------
Checking for existence: F:\codeblocks-17.12-nosetup\Projects\19-01-26 - test-ogl\test\bin\Release_x86\test.exe
Executing: "F:\codeblocks-17.12-nosetup\Projects\19-01-26 - test-ogl\test\bin\Release_x86\test.exe" (in F:\codeblocks-17.12-nosetup\Projects\19-01-26 - test-ogl\test\.)
Process terminated with status 0 (0 minute(s), 1 second(s))
And the other one (error in the last line):
Output file is glLive3d\glLive3d.exe with size 1,85 MB
Process terminated with status 0 (0 minute(s), 18 second(s))
0 error(s), 0 warning(s) (0 minute(s), 18 second(s))
-------------- Run: Release in glLive3d (compiler: GNU GCC Compiler)---------------
Checking for existence: F:\codeblocks-17.12-nosetup\Projects\19-01-24 - ThreadTest\glLive3d\glLive3d.exe
Executing: "F:\codeblocks-17.12-nosetup\Projects\19-01-24 - ThreadTest\glLive3d\glLive3d.exe" (in F:\codeblocks-17.12-nosetup\Projects\19-01-24 - ThreadTest\.)
Process terminated with status -1073741515 (0 minute(s), 3 second(s))
Both were compiled in the same C::B-workspace without closing C::B in between.
I do not know where you got the portable codeblocks version
Here: https://sourceforge.net/projects/codeblocks/files/Binaries/17.12/Windows/
Inside the unpacked archieve is a local UserData-folder. Maybe the C::B-nosetup version is configured to use this one instaed of the common one. For me it seem like this, because after duplicating the whole folder, i was abel to save and restore different settings for both.
mignw32-make.exe -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=1
There is done something, after i remembered ".exe" is not needed on windows. Also i have to enter the path of mingw32-make.
There is a two nested folders "gcc_lib/msw" created in my wxWidgets-folder with a file "setup.h" inside.
But then it stops.
Here the console-output:
F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\build\msw>C:\Users\BeamIt\mingw32\bin\mingw32-make -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=1
if not exist ..\..\lib\gcc_lib mkdir ..\..\lib\gcc_lib
if not exist ..\..\lib\gcc_lib\mswud mkdir ..\..\lib\gcc_lib\mswud
if not exist ..\..\lib\gcc_lib\mswud\wx mkdir ..\..\lib\gcc_lib\mswud\wx
if not exist ..\..\lib\gcc_lib\mswud\wx\setup.h copy ..\..\include\wx\msw\setup.h ..\..\lib\gcc_lib\mswud\wx\setup.h
1 Datei(en) kopiert.
if not exist ..\..\lib\gcc_lib\mswud\wx\msw mkdir ..\..\lib\gcc_lib\mswud\wx\msw
gcc -E "..\..\include\wx\msw\genrcdefs.h" > "..\..\lib\gcc_lib\mswud\wx\msw\rcdefs.h"
Der Befehl "gcc" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
mingw32-make: *** [makefile.gcc:5743: ..\..\lib\gcc_lib\mswud\wx\msw\rcdefs.h] Error 1
Atfer a second mingw32-make-call, one more file was created, but after this always the same error-message appears:
F:\codeblocks-17.12-nosetup\wxWidgets-3.1.2\build\msw>C:\Users\BeamIt\mingw32\bin\mingw32-make -f makefile.gcc BUILD=debug SHARED=0 MONOLITHIC=1
gcc -c -o gcc_mswud\wxregex_regcomp.o -g -O0 -mthreads -DHAVE_W32API_H -DNDEBUG -I..\..\include -I..\..\lib\gcc_lib\mswud -D__WXMSW__ -D_UNICODE -MTgcc_mswud\wxregex_regcomp.o -MFgcc_mswud\wxregex_regcomp.o.d -MD -MP ../../src/regex/regcomp.c
gcc: error: CreateProcess: No such file or directory
mingw32-make: *** [makefile.gcc:5787: gcc_mswud\wxregex_regcomp.o] Error 1
Think, i have to sleep sometimes, but i'll continue at this point tomorrow. I really have to learn this - but this helped a lot...
Also i have to enter the path of mingw32-make.
because your compiler is not in the path
But then it stops.
Der Befehl "gcc" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
because your compiler is not in the path