Where to put the -static switch?
Posted: Wed Mar 28, 2012 12:05 pm
I don't know where to put the -static switch and how to insert the static libraries.
Used toolchain:
IDE: CodeLite 3.5.5377
Compiler: Unofficial TDM MinGW_v4.4.1
wxWidgets: wxPack v2.8.12.01
I create a new wxWidgets HelloWorld Projekt and compile it with -mwindows;$(shell wx-config --debug=no --libs --unicode=yes) and it works. After that i want that program to run on a non-developer machine, but i get the error message: wxmsw28u_gcc.dll not found. Then i compile the program with -mwindows;$(shell wx-config --debug=no --libs --unicode=yes --static) and only get:
Even if i go to project options and insert "C:/wxWidgets2.8/lib/gcc_lib" into Linker->Library Paths as well as insert "libwxmsw28u.a;libwxbase28u.a" into Linker->Libraries it don't works.
In Code::Blocks i just have to insert the dependencies into Settings->Compiler and debugger...->Linker settings->Link libraries and add the -static switch to Other linker options. After that it will link every program statically.
Used toolchain:
IDE: CodeLite 3.5.5377
Compiler: Unofficial TDM MinGW_v4.4.1
wxWidgets: wxPack v2.8.12.01
I create a new wxWidgets HelloWorld Projekt and compile it with -mwindows;$(shell wx-config --debug=no --libs --unicode=yes) and it works. After that i want that program to run on a non-developer machine, but i get the error message: wxmsw28u_gcc.dll not found. Then i compile the program with -mwindows;$(shell wx-config --debug=no --libs --unicode=yes --static) and only get:
Code: Select all
----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe" -j 4 -f "Test_wsp.mk""
----------Building project:[ Test - Release ]----------
mingw32-make.exe[1]: Entering directory `C:/Users/DarkBug/Desktop/Test'
g++ -c "C:/Users/DarkBug/Desktop/Test/main.cpp" -O2 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -DNDEBUG -D_UNICODE -IC:\wxWidgets2.8\lib\gcc_dll\mswu -IC:\wxWidgets2.8\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -Wno-attributes -o ./Release/main.o -I.
g++ -o ./Release/Test @"C:\Users\DarkBug\Desktop\Test\Test.txt" -L. -mwindows -s -mthreads -LC:\wxWidgets2.8\lib\gcc_lib -lwxmsw28u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
./Release/main.o:main.cpp:(.text+0x4): undefined reference to `_imp___ZN12wxAppConsole14ms_appInstanceE'
./Release/main.o:main.cpp:(.text+0x10): undefined reference to `_imp___ZN12wxAppConsole12ms_appInitFnE'
./Release/main.o:main.cpp:(.text+0x3f): undefined reference to `_imp___Z7wxEntryP11HINSTANCE__S0_Pci'
./Release/main.o:main.cpp:(.text+0x60): undefined reference to `_imp___ZN12wxAppConsole17CheckBuildOptionsEPKcS1_'
./Release/main.o:main.cpp:(.text+0x77): undefined reference to `_imp___ZN5wxAppC2Ev'
./Release/main.o:main.cpp:(.text+0xad): undefined reference to `_imp___ZN12wxStringBase4nposE'
./Release/main.o:main.cpp:(.text+0xce): undefined reference to `_imp___ZN12wxStringBase8InitWithEPKwjj'
./Release/main.o:main.cpp:(.text+0xf2): undefined reference to `_imp__wxFrameNameStr'
./Release/main.o:main.cpp:(.text+0x112): undefined reference to `_imp__wxDefaultPosition'
./Release/main.o:main.cpp:(.text+0x11e): undefined reference to `_imp___ZN11wxFrameBaseC2Ev'
./Release/main.o:main.cpp:(.text+0x123): undefined reference to `_imp___ZTV7wxFrame'
./Release/main.o:main.cpp:(.text+0x131): undefined reference to `_imp___ZN7wxFrame4InitEv'
./Release/main.o:main.cpp:(.text+0x16e): undefined reference to `_imp___ZN7wxFrame6CreateEP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_'
./Release/main.o:main.cpp:(.text+0x1e1): undefined reference to `_imp__wxButtonNameStr'
./Release/main.o:main.cpp:(.text+0x205): undefined reference to `_imp___ZN12wxWindowBaseC2Ev'
./Release/main.o:main.cpp:(.text+0x20a): undefined reference to `_imp___ZTV8wxWindow'
./Release/main.o:main.cpp:(.text+0x240): undefined reference to `_imp___ZN8wxWindow4InitEv'
./Release/main.o:main.cpp:(.text+0x245): undefined reference to `_imp___ZTV9wxControl'
./Release/main.o:main.cpp:(.text+0x259): undefined reference to `_imp___ZN15wxBaseArrayLongC2Ev'
./Release/main.o:main.cpp:(.text+0x25e): undefined reference to `_imp___ZTV12wxButtonBase'
./Release/main.o:main.cpp:(.text+0x269): undefined reference to `_imp___ZTV8wxButton'
./Release/main.o:main.cpp:(.text+0x277): undefined reference to `_imp__wxDefaultValidator'
./Release/main.o:main.cpp:(.text+0x288): undefined reference to `_imp__wxDefaultSize'
./Release/main.o:main.cpp:(.text+0x2b2): undefined reference to `_imp___ZN8wxButton6CreateEP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelRK11wxValidatorS4_'
./Release/main.o:main.cpp:(.text+0x2ef): undefined reference to `_imp__wxEVT_COMMAND_BUTTON_CLICKED'
./Release/main.o:main.cpp:(.text+0x32e): undefined reference to `_imp___ZN12wxEvtHandler7ConnectEiiiM8wxObjectFvR7wxEventEPS0_PS_'
./Release/main.o:main.cpp:(.text+0x3b6): undefined reference to `_imp___ZN9wxControlD2Ev'
./Release/main.o:main.cpp:(.text+0x3cb): undefined reference to `_imp___ZN13wxControlBaseD2Ev'
./Release/main.o:main.cpp:(.text+0x3d8): undefined reference to `_imp___ZN12wxWindowBaseD2Ev'
./Release/main.o:main.cpp:(.text+0x3e9): undefined reference to `_imp___ZN11wxFrameBaseD2Ev'
./Release/main.o:main.cpp:(.text$_ZNK12wxWindowBase7GetNameEv[wxWindowBase::GetName() const]+0x2a): undefined reference to `_imp__wxEmptyString'
./Release/main.o:main.cpp:(.text$_ZN9wxMiniAppD1Ev[wxMiniApp::~wxMiniApp()]+0x10): undefined reference to `_imp___ZN5wxAppD2Ev'
./Release/main.o:main.cpp:(.text$_ZN9wxMiniAppD0Ev[wxMiniApp::~wxMiniApp()]+0x15): undefined reference to `_imp___ZN5wxAppD2Ev'
./Release/main.o:main.cpp:(.text$_ZN9wxControl7CommandER14wxCommandEvent[wxControl::Command(wxCommandEvent&)]+0x7): undefined reference to `_imp___ZN9wxControl14ProcessCommandER14wxCommandEvent'
./Release/main.o:main.cpp:(.text$_ZN12wxWindowBase18SetInitialBestSizeERK6wxSize[wxWindowBase::SetInitialBestSize(wxSize const&)]+0x7): undefined reference to `_imp___ZN12wxWindowBase14SetInitialSizeERK6wxSize'
./Release/main.o:main.cpp:(.text$_ZNK9wxControl20GetDefaultAttributesEv[wxControl::GetDefaultAttributes() const]+0x1c): undefined reference to `_imp___ZN9wxControl25GetClassDefaultAttributesE15wxWindowVariant'
./Release/main.o:main.cpp:(.text$_ZNK12wxWindowBase10HasCaptureEv[wxWindowBase::HasCapture() const]+0x8): undefined reference to `_imp___ZN12wxWindowBase10GetCaptureEv'
./Release/main.o:main.cpp:(.text$_ZN12wxWindowBase19SetAcceleratorTableERK18wxAcceleratorTable[wxWindowBase::SetAcceleratorTable(wxAcceleratorTable const&)]+0x19): undefined reference to `_imp___ZN8wxObject3RefERKS_'
./Release/main.o:main.cpp:(.text$_ZN12wxWindowBase7SetNameERK8wxString[wxWindowBase::SetName(wxString const&)]+0x12): undefined reference to `_imp___ZN12wxStringBaseaSERKS_'
./Release/main.o:main.cpp:(.text$_ZN12wxButtonBaseD0Ev[wxButtonBase::~wxButtonBase()]+0xb): undefined reference to `_imp___ZTV12wxButtonBase'
./Release/main.o:main.cpp:(.text$_ZN12wxButtonBaseD0Ev[wxButtonBase::~wxButtonBase()]+0x19): undefined reference to `_imp___ZN9wxControlD2Ev'
./Release/main.o:main.cpp:(.text$_ZN12wxButtonBaseD1Ev[wxButtonBase::~wxButtonBase()]+0xb): undefined reference to `_imp___ZTV12wxButtonBase'
./Release/main.o:main.cpp:(.text$_ZN12wxButtonBaseD1Ev[wxButtonBase::~wxButtonBase()]+0x15): undefined reference to `_imp___ZN9wxControlD2Ev'
./Release/main.o:main.cpp:(.text$_ZN9wxMiniApp7OnClickER14wxCommandEvent[wxMiniApp::OnClick(wxCommandEvent&)]+0x1f): undefined reference to `_imp___ZN12wxWindowBase5CloseEb'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Release/Test] Error 1
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `C:/Users/DarkBug/Desktop/Test'
----------Build Ended----------
44 errors, 0 warnings
In Code::Blocks i just have to insert the dependencies into Settings->Compiler and debugger...->Linker settings->Link libraries and add the -static switch to Other linker options. After that it will link every program statically.