wxwidgets Programme nur mit MinGW ohne IDEs und MSYS
-
Ich hätte auch eine Frage, wie linke ich wxwidgets Programme ohne MSYS nur mit dem G++? Ich möchte gerne das einmal mit statisch gelinken Libs und einmal zum Entwickeln mit dynamischer Debug Lib haben, hat da wer Erfahrung mit MinGW und ohne irgendwelche IDEs und ohne MSYS?
Dankeschön und Gruß
Horstilein
-
Müsstest du dich in die entsprechenden Makefiles einarbeiten.
-
habe ich und gestern noch stundenlang recherchiert.
makefile für dynamisch
CC = g++ CFLAGS = LDFLAGS = -lm WXCFLAGS = -I"D:\dev\wxWidgets-2.8.11\build-shared\lib\wx\include\msw-unicode-release-2.8" -I"D:\dev\wxWidgets-2.8.11\include" -I"D:\dev\wxWidgets-2.8.11\contrib\include" -DWXUSINGDLL -D__WXMSW__ -mthreads WXLDFLAGS = -L"D:\dev\wxWidgets-2.8.11\build-shared\lib" -mthreads -Wl,--subsystem,windows -mwindows -lwx_mswu-2.8 hello.exe : hello.o $(CC) $(LDFLAGS) $(WXLDFLAGS) -o $@ $^ hello.o: hello.cpp $(CC) $(CFLAGS) $(WXCFLAGS) -o $@ -c $<
und hier auszug aus den fehlermeldungen mit dem mingw32-make
mingw32-make g++ -I"D:\dev\wxWidgets-2.8.11\build-shared\lib\wx\include\msw-unicode-release-2.8" -I"D:\dev\wxWidgets-2.8.11\include" -I"D:\dev\wxWidgets-2.8.11\contrib\include" -DWXUSINGDLL -D__WXMSW__ -mthreads -o hello.o -c hello.cpp g++ -lm -L"D:\dev\wxWidgets-2.8.11\build-shared\lib" -mthreads -Wl,--subsystem,windows -mwindows -lwx_mswu-2.8 -o hello.exe hello.o hello.o:hello.cpp:(.text+0x59): undefined reference to `_imp___ZN12wxAppConsole17CheckBuildOptionsEPKcS1_' hello.o:hello.cpp:(.text+0x108): undefined reference to `_imp___Z7wxEntryP11HINSTANCE__S0_Pci' hello.o:hello.cpp:(.text+0x158): undefined reference to `wxAppConsole::OnInit()' hello.o:hello.cpp:(.text+0x2a7): undefined reference to `_imp__wxFrameNameStr' hello.o:hello.cpp:(.text+0x2d1): undefined reference to `_imp__wxDefaultSize' hello.o:hello.cpp:(.text+0x2da): undefined reference to `_imp__wxDefaultPosition' . . . collect2: ld returned 1 exit status mingw32-make: *** [hello.exe] Error 1 Compilation exited abnormally with code 2 at Fri Jun 04 08:45:11
mit dem statischen makefile habe ich auch ähnliche fehlermeldungen vom linker denke ich mal.
-
Da fehlen dir wohl einige wxLibs. Musst du wohl noch hinzulinken.
-
Welche könnte das sein? Es gibt doch bloss eine da ich mit monolithic und shared wxwidgets kompiliert hatte.
-
Dann keine Ahnung.
Versuchs mal ohne Monolithic, das habe ich noch nie benutzt.
-
danke trotzdem. monolithic bedeutet das alles in nur eine dynamsiche lib kommt und darf bei static nicht angewandt werden.
-
horstilein schrieb:
danke trotzdem. monolithic bedeutet das alles in nur eine dynamsiche lib kommt und darf bei static nicht angewandt werden.
Doch, es darf auch bei static benutzt werden. Du musst manchmal noch die Image, regex und Zip-Libs dazulinken, ansonsten musst du noch folgende Libs linken:
-lgdi32 -lcomctl32 -lole32 -loleaut32 -luuid
Hier mal ein ganzer Statischer, Monolithischer Unicode-Aufruf:
C:\MinGW\bin\g++ -mwindows -Wno-long-long -O3 -s -IC:\wxWidgets-2.9.0\include file.cpp wx.o -o file.exe -LC:\wxWidgets-2.9.0\lib\gcc_lib -lwxmsw29u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lwxregex -lwxscintilla -lgdi32 -lcomctl32 -lole32 -loleaut32 -luuidwx.o ist das kompilierte wx.rc oder zumindest das wx.manifest in der Resource, ansonsten wirken manche wxWindows Win2000-like.
Dynamisch hab' ich von Hand noch nicht kompiliert, sollte aber ähnlich funktionieren.
P.S. Du kannst auch z.B. bei Code::Blocks ein wxWidgets-Projekt anlegen, dann bei Settings->Compiler and debugger... ->Other Settings bei "Compiler logging" "Full Command Line" auswählen, dann siehst du bei Code::Blocks, mit welchem Kommando es deine Datei kompiliert.
-
Danke, ich habe alles hinbekommen, bin nach dem wxwiki gegangen und habe die Flags aus dem minmal sample kopiert.