Hi all,
I've been using CodeBlocks (SVN 4977) with wxWidgets (2.8.7) to develop an application of mine. After many hours of installation and reinstallation of wxWidgets using various build options under MinGW, I've gotten my app to compile in debug and release builds. However, these builds require the wxWidgets DLL to be present. I would like to link my app as a release build without having to have the wxWidgets DLL accompany my .exe file. Before you answer, let me say that I've tried many methods to get CodeBlocks to compile and link my app (no DLL release) with no success. I've compiled wxWidgets using the following options:
mingw32-make.exe -f makefile.gcc USE_XRC=1 SHARED=0 MONOLITHIC=1 RUNTIME_LIBS=static BUILD=release UNICODE=1
A gcc_lib directory is created with the following files:
libwxexpat.a
libwxjpeg.a
libwxmsw28u.a
libwxpng.a
libwxregexu.a
libwxtiff.a
libwxzlib.a
...and a directory: mswu
In CodeBlocks I've set up the following build option called ReleaseNoDLL:
Compiler settings (Policy: Append target options to project options):
Compiler Flags that are checked:
Strip all symbols from binary (minimizes size) [-s]
Optimize even more (for speed) [-O2]
Other options and #defines are blank
Linker settings (Policy: Prepend target options to project options):
Link libraries:
libwxmsw28u.a
libwxpng.a
libwxjpeg.a
libwxtiff.a
libwxzlib.a
Search directories (Policy: Append target options to project options):
Compiler:
C:\wxMSW-2.8.7\lib\gcc_lib\mswu
Linker:
C:\wxMSW-2.8.7\lib\gcc_lib
Resource Compiler:
C:\wxMSW-2.8.7\lib\gcc_lib\mswu
Nothing added for the other tabs (Pre/post build step, Custom variables, "Make" commands)
For the overall project build (covers Debug, Release, and ReleaseNoDLL builds) I've set up the following:
Compiler settings:
Compiler Flags that are checked:
Enable all compiler warnings (overrides every other setting) [-Wall]
Other options:
-pipe
-mthreads
[[if (PLATFORM == PLATFORM_MSW && (GetCompilerFactory().GetCompilerVersionString(_T("gcc")) >= _T("4.0.0"))) print(_T("-Wno-attributes"));]]
-Winvalid-pch
-include wx_pch.h
#defines
__GNUWIN32__
__WXMSW__
wxUSE_UNICODE
WX_PRECOMP
Linker settings:
Link libraries are blank
Search directories:
Compiler:
C:\wxMSW-2.8.7\include
C:\wxMSW-2.8.7\contrib\include
Linker is blank
Resource Compiler:
C:\wxMSW-2.8.7\include
Nothing added for the other tabs (Pre/post build step, Custom variables, "Make" commands)
When the new build was created I chose the wxWidgets build with the following in the configuration options window:
Use wxWidgets DLL unchecked
wxWidgets is built as a monolithic library checked
Enable unicode checked
Create Empty Project unchecked
Create and use precompiled header (PCH) checked
Configuration: left blank
Configure Advanced Options unchecked
Finally, when I try to build using the ReleaseNoDLL build option, I get the following linker errors:
||=== LcnGui, ReleaseNoDLL ===|
||warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: created using different flags|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x44)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x60)||undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xbb)||undefined reference to `_imp___ZN12wxStringBase10ConcatSelfEjPKwj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xec)||undefined reference to `_imp___ZN12wxStringBase10ConcatSelfEjPKwj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x16c)||undefined reference to `_imp___ZN12wxWindowBase5CloseEb'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x1db)||undefined reference to `_imp___Z11wxGetLocalev'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x212)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x230)||undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x260)||undefined reference to `_imp___Z12wxMessageBoxRK8wxStringS1_lP8wxWindowii'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x393)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x3b3)||undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x440)||undefined reference to `_imp___ZN8wxString6PrintfEPKwz'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x5e7)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x612)||undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x7e1)||undefined reference to `_imp___ZN12wxStringBase6appendEjw'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x804)||undefined reference to `_imp___ZNK8wxString5RightEj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x8a4)||undefined reference to `_imp___ZNK8wxString4LeftEj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x8c0)||undefined reference to `_imp___ZN12wxStringBaseaSERKS_'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x901)||undefined reference to `_imp___ZNK8wxString4FindEwb'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x927)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x947)||undefined reference to `_imp___ZNK8wxString3MidEjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x961)||undefined reference to `_imp___ZN12wxStringBaseaSERKS_'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x9c9)||undefined reference to `_imp___ZN8wxString7ReplaceEPKwS1_b'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x9f5)||undefined reference to `_imp___ZN8wxString7ReplaceEPKwS1_b'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xa1f)||undefined reference to `_imp___ZN8wxString7ReplaceEPKwS1_b'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xa49)||undefined reference to `_imp___ZN8wxString7ReplaceEPKwS1_b'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xa5e)||undefined reference to `_imp___ZN8wxString4TrimEb'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xa76)||undefined reference to `_imp___ZN8wxString4TrimEb'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xa94)||undefined reference to `_imp___ZNK8wxString4FindEwb'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xab2)||undefined reference to `_imp___ZNK8wxString3MidEjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xad7)||undefined reference to `_imp___ZNK8wxString8ToDoubleEPd'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xc25)||undefined reference to `_imp__wxConvUTF8'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xc31)||undefined reference to `_imp___ZNK8wxString6mb_strERK8wxMBConv'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xc8e)||undefined reference to `_imp___ZN8wxString8TruncateEj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xd74)||undefined reference to `_imp___ZNK8wxString5RightEj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xe7d)||undefined reference to `_imp___ZNK8wxString4FindEwb'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xe87)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xea3)||undefined reference to `_imp___ZNK8wxString3MidEjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xec7)||undefined reference to `_imp___ZNK8wxString8ToDoubleEPd'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xf42)||undefined reference to `_imp___Z10wxLogErrorPKwz'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xfaf)||undefined reference to `_imp___ZN8wxThread6CreateEj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0xfc9)||undefined reference to `_imp___Z10wxLogErrorPKwz'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x101d)||undefined reference to `_imp___ZN8wxThread3RunEv'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x10a4)||undefined reference to `_imp___ZN8wxThread6DeleteEPPv'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x10af)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x10d0)||undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x11d8)||undefined reference to `_imp___ZN12wxStringBase4nposE'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x11fc)||undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x1223)||undefined reference to `_imp___ZN8wxRegKeyC1ERK8wxString'|
obj\ReleaseNoDLL\LcnGuiMain.o:LcnGuiMain.cpp:(.text+0x1293)||undefined reference to `_imp___ZN8wxRegKey8SetValueEPKwRK8wxString'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 1 warnings ===|
I've looked exhaustively for answers and could not find any that would help. I hope I've given enough detail here. Let me know if you need more information. Thanks for your help.