Also, there were no compiler errors with either file, and I don't think I changed any options in Code Blocks between Structure of a Programme working and everything not working. Thanks, Dalkius. Edit: Build logs.
Active1 year, 10 months ago
I'm trying to build this wxWidgets sample program using Code::Blocks 12.11 but the build fails no matter what I try.
For example, the build log shows the following (the project is under X:programmingc++HelloWxWidgets):
mingw32-g++.exe -Wall -fexceptions -g -D_GNUWIN32_ -D_WXMSW_ -DwxUSE_UNICODE -D_WXDEBUG_ -IC:librarieswxWidgets-2.8.12.01include -IC:librarieswxWidgets-2.8.12.01contribinclude -IC:librarieswxWidgets-2.8.12.01libgcc_libmswud -c X:programmingc++HelloWxWidgetshworld2.cpp -o objDebug2hworld2.o mingw32-g++.exe -LC:librarieswxWidgets-2.8.12.01libgcc_lib -o binDebug2HelloWxWidgets.exe objDebug2hworld2.o -static-libgcc C:librarieswxWidgets-2.8.12.01libgcc_liblibwxmsw28ud.a C:librarieswxWidgets-2.8.12.01libgcc_liblibwxmsw28ud.a(monolib_window.o): In function
ZN8wxWindow6UpdateEv': C:BuildAgentworkwxPackwxwidgetsbuildmsw/../../src/msw/window.cpp:1643: undefined reference to GdiFlush@0' C:librarieswxWidgets-2.8.12.01libgcc_liblibwxmsw28ud.a(monolib_window.o): In function ZNK8wxWindow13GetTextExtentERK8wxStringPiS3_S3_S3_PK6wxFont': C:BuildAgentworkwxPackwxwidgetsbuildmsw/../../src/msw/window.cpp:2132: undefined reference to GetTextExtentPoint32W@16' C:BuildAgentworkwxPackwxwidgetsbuildmsw/../../src/msw/window.cpp:2133: undefined reference to `GetTextMetricsW@8'
And these are some of the build messages that I get
How To Compile C Code
C:librarieswxWidgets-2.8.12.01libgcc_liblibwxmsw28ud.a(monolib_window.o)||In function
ZN8wxWindow6UpdateEv':| C:BuildAgentworkwxPackwxwidgetsbuildmsw....srcmswwindow.cpp|1643|undefined reference to GdiFlush@0'| C:librarieswxWidgets-2.8.12.01libgcc_liblibwxmsw28ud.a(monolib_window.o)||In function ZNK8wxWindow13GetTextExtentERK8wxStringPiS3_S3_S3_PK6wxFont':| C:BuildAgentworkwxPackwxwidgetsbuildmsw....srcmswwindow.cpp|2132|undefined reference to GetTextExtentPoint32W@16'| C:BuildAgentworkwxPackwxwidgetsbuildmsw....srcmswwindow.cpp|2133|undefined reference to `GetTextMetricsW@8'|
Here are the full build log and all of the build messages (by the way, I don't have a C:BuildAgent directory)
I am using wxPack 2.8.12 (installed in C:librarieswxWidgets-2.8.12.01) and GCC 4.7.2 (installed separately from Code::Blocks in C:mingw using mingw-get )
Here are the build options in Code::Blocks
Thank you in advance of your help :)
maddouri
How To Compile C Program Linuxmaddourimaddouri
2,57444 gold badges1717 silver badges4242 bronze badges
3 AnswersDownload Software How To Compile C Programming In Code Blocks
Alright, I finally managed to get it working :)
I'm posting here the procedure to follow if, like me, someone wanted to use wxWidgets in an (initially) console project under Code::Blocks. With this, anyone should be able to build/run at least this sample code in a Wind0ws environment:
[EDIT] wx/app.h should be included in addition to wx/wx.h
You probably need to add following libs to linker settings (I took the list from VS 2012 but for GCC should be the same, you will need to add -luuid -luser32 .... to linker advanced options)
How To Compile C Program
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
How To Compile C Program In Command Line
UPD: can see taht chris suggested to add gdi32 lib. Looks reasonable for me. At least missing functions from your logs are defined there.
T-RexT-Rex
How To Compile C Program In Ubuntu
79111 gold badge44 silver badges1919 bronze badges
I found a best way is that add ``wx-config --libs all` in your 'other liner options' ,On this ,many issue will gone.
andrewandrew
How To Compile C++ In WindowsNot the answer you're looking for? Browse other questions tagged c++mingwwxwidgetslinker-errorscodeblocks or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |