Hi all.
I´m a newbee with code::blocks and I´m having problems to make a GUI
application to work. At once, I´ve looked for references in the web, but I´m not
getting away with it. So, I´m "terrific desperate" looking for somebody to help me.
I proceeded the following steps describes below:
1) I executed "codeblocks-1.0rc2_mingw.exe", installed it in the
"C:\Arquivos de programas\CodeBlocks" directory.
2) I started the program and choosed "GNU GCC Compiler" like my compiler default.
3) I installed wxWidgets-2.6.3 with "wxMSW-2.6.3-Setup-1.exe" in
"C:\desenv\wxWidgets-2.6.3\" and compiled it using the following commands
in the DOS command prompt:
set path=C:\Arquivos de programas\CodeBlocks\bin;
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 clean
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1
The compiling shows any warnnings but goes at the end and produced the
following libraries in the "C:\desenv\wxWidgets-2.6.3\lib\gcc_dll":
libwxexpat.a,
libwxjpeg.a,
libwxmsw26u.a,
libwxpng.a,
libwxregexu.a,
libwxtiff.a,
libwxzlib.a
4) In the code::block program, I created new project using "wxWidget Application"
template named "teste" in the "C:\desenv\projetos" with the following options:
"Using UNICODE static wxWidget library", <- Because, I compiling the wxWidget using UNICODE=1
"Use separate wxApp, wxFrame files"
5) Everything OK until here! So, I decided compling the "teste" application and
obtained the following message: "ld.exe: cannot find -lwxmswu".
I know! I know! I know! I forgot change the "project´s build options"->linker->"link libraries".
I edited the "wxmswu" option, changing it for "C:\desenv\wxWidgets-2.6.3\lib\gcc_dll\libwxmsw26u.a"
and try compile again. Now, a lot of problems appeared and I don´t know more what to do:
Project : wxWidgets application
Compiler : GNU GCC Compiler (called directly)
Directory : C:\desenv\projetos\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\desenv\projetos\teste.exe
.objs\main.o:main.cpp:(.text+0x7de): undefined reference to `wxFrame::SetMenuBar(wxMenuBar*)'
.objs\main.o:main.cpp:(.text+0xf10): undefined reference to `wxFrame::SetMenuBar(wxMenuBar*)'
.objs\main.o:main.cpp:(.text$_ZN10wxMenuBase6AppendEiRK8wxStringS2_b[wxMenuBase::Append(int, wxString const&, wxString const&, bool)]+0x38): undefined reference to `_imp___ZN14wxMenuItemBase3NewEP6wxMenuiRK8wxStringS4_bS1_'
.objs\main.o:main.cpp:(.text$_ZN18wxAcceleratorArrayD1Ev[wxAcceleratorArray::~wxAcceleratorArray()]+0x16): undefined reference to `_imp___ZN11wxBaseArrayD2Ev'
.objs\main.o:main.cpp:(.text$_ZN18wxAcceleratorArrayC1Ev[wxAcceleratorArray::wxAcceleratorArray()]+0xd): undefined reference to `_imp___ZN11wxBaseArrayC2Ev'
.objs\main.o:main.cpp:(.text$_Z16wxGetTranslationPKc[wxGetTranslation(char const*)]+0x2c): undefined reference to `_imp___ZNK8wxLocale9GetStringEPKcS1_'
.objs\main.o:main.cpp:(.text$_ZN8wxStringC1EPKcj[wxString::wxString(char const*, unsigned int)]+0x23): undefined reference to `_imp___ZN8wxString8InitWithEPKcjj'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x14): undefined reference to `wxObject::CopyObject(wxObject&) const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x24): undefined reference to `wxWindowBase::LoadFromResource(wxWindow*, wxString const&, wxResourceTable const*)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x28): undefined reference to `wxWindowBase::CreateItem(wxItemResource const*, wxItemResource const*, wxResourceTable const*)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x2c): undefined reference to `wxFrameBase::Destroy()'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x58): undefined reference to `wxFrame::Show(bool)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x6c): undefined reference to `wxFrameBase::MakeModal(bool)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x84): undefined reference to `wxFrame::RemoveChild(wxWindowBase*)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0xa8): undefined reference to `wxWindow::CaptureMouse()'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0xac): undefined reference to `wxWindow::ReleaseMouse()'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0xb4): undefined reference to `wxWindow::Clear()'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x124): undefined reference to `wxFrameBase::DoClientToScreen(int*, int*) const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x128): undefined reference to `wxFrameBase::DoScreenToClient(int*, int*) const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x12c): undefined reference to `wxFrame::DoGetPosition(int*, int*) const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x130): undefined reference to `wxFrame::DoGetSize(int*, int*) const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x150): undefined reference to `wxWindowBase::DoSetClientObject(wxClientData*)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x154): undefined reference to `wxWindowBase::DoGetClientObject() const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x158): undefined reference to `wxWindowBase::DoSetClientData(void*)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x15c): undefined reference to `wxWindowBase::DoGetClientData() const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x160): undefined reference to `wxWindow::Reparent(wxWindow*)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x174): undefined reference to `wxWindow::AdjustForParentClientOrigin(int&, int&, int)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x180): undefined reference to `wxWindow::CreateWindowFromHWND(wxWindow*, unsigned long)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x18c): undefined reference to `wxWindow::MSWOnScroll(int, unsigned short, unsigned short, unsigned long)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1a0): undefined reference to `wxWindow::MSWProcessMessage(void**)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1a4): undefined reference to `wxFrame::MSWTranslateMessage(void**)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1ac): undefined reference to `wxWindow::OnCtlColor(unsigned long, unsigned long, unsigned int, unsigned int, unsigned int, long)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1b0): undefined reference to `wxFrame::Maximize(bool)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1b4): undefined reference to `wxFrame::Restore()'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1b8): undefined reference to `wxFrame::Iconize(bool)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1bc): undefined reference to `wxFrame::IsMaximized() const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1c0): undefined reference to `wxFrame::IsIconized() const'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1c4): undefined reference to `wxFrame::SetIcon(wxIcon const&)'
.objs\main.o:main.cpp:(.rdata$_ZTV7MyFrame[vtable for MyFrame]+0x1c8): undefined reference to `wxFrame::SetMenuBar(wxMenuBar*)'
.objs\main.o:main.cpp:(.rdata$_ZTV14wxMenuItemList[vtable for wxMenuItemList]+0x14): undefined reference to `wxObject::CopyObject(wxObject&) const'
.objs\main.o:main.cpp:(.text$_ZNK8wxObject12GetClassInfoEv[wxObject::GetClassInfo() const]+0x4): undefined reference to `_imp___ZN8wxObject16sm_classwxObjectE'
.objs\main.o:main.cpp:(.text$_ZN18wxAcceleratorArrayD0Ev[wxAcceleratorArray::~wxAcceleratorArray()]+0x16): undefined reference to `_imp___ZN11wxBaseArrayD2Ev'
.objs\main.o:main.cpp:(.text$_ZN12wxWindowBase7SetNameERK8wxString[wxWindowBase::SetName(wxString const&)]+0x19): undefined reference to `_imp___ZN8wxStringaSERKS_'
.objs\main.o:main.cpp:(.text$_ZNK7wxFrame12GetClassInfoEv[wxFrame::GetClassInfo() const]+0x4): undefined reference to `_imp___ZN7wxFrame15sm_classwxFrameE'
.objs\app.o:app.cpp:(.text+0x1b2): undefined reference to `_imp__wxTheApp'
.objs\app.o:app.cpp:(.text+0x1e4): undefined reference to `_imp___Z7wxEntryPvS_Pcib'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x14): undefined reference to `wxObject::CopyObject(wxObject&) const'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x38): undefined reference to `wxApp::MainLoop()'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x3c): undefined reference to `wxApp::ExitMainLoop()'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x40): undefined reference to `wxApp::Initialized()'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x44): undefined reference to `wxApp::Pending()'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x48): undefined reference to `wxApp::Dispatch()'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x50): undefined reference to `wxApp::GetStdIcon(int) const'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x58): undefined reference to `wxAppBase::ProcessPendingEvents()'
.objs\app.o:app.cpp:(.rdata$_ZTV5MyApp[vtable for MyApp]+0x64): undefined reference to `wxApp::ProcessMessage(void**)'
.objs\app.o:app.cpp:(.text$_ZN9wxAppBase22SetInitializerFunctionEPFP5wxAppvE[wxAppBase::SetInitializerFunction(wxApp* (*)())]+0x5): undefined reference to `_imp___ZN9wxAppBase11m_appInitFnE'
.objs\app.o:app.cpp:(.text$_ZNK5wxApp12GetClassInfoEv[wxApp::GetClassInfo() const]+0x4): undefined reference to `_imp___ZN5wxApp13sm_classwxAppE'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
The teste.cbp file contain:
<?xml version="1.0"?>
<!DOCTYPE Code::Blocks_project_file>
<Code::Blocks_project_file>
<FileVersion major="1" minor="1"/>
<Project>
<Option title="wxWidgets application"/>
<Option makefile="Makefile"/>
<Build>
<Target title="default">
<Option type="0"/>
</Target>
<Environment>
<Variable name="WX_DIR" value="C:\wxWidgets-2.6.2"/>
<Variable name="WX_CFG" value=""/>
</Environment>
</Build>
<Compiler>
<Add option="-pipe"/>
<Add option="-mthreads"/>
<Add option="-Winvalid-pch"/>
<Add option="-include "wx_pch.h""/>
<Add option="-D__GNUWIN32__"/>
<Add option="-D__WXMSW__"/>
<Add option="-DwxUSE_UNICODE"/>
<Add option="-DUSE_PCH"/>
<Add directory="$(WX_DIR)\include"/>
<Add directory="$(WX_DIR)\lib\gcc_lib$(WX_CFG)\mswu"/>
<Add directory="$(WX_DIR)\contrib\include"/>
</Compiler>
<ResourceCompiler>
<Add directory="$(WX_DIR)\include"/>
</ResourceCompiler>
<Linker>
<Add library="wxmswu"/>
<Add library="winspool"/>
<Add library="winmm"/>
<Add library="shell32"/>
<Add library="comctl32"/>
<Add library="ctl3d32"/>
<Add library="odbc32"/>
<Add library="advapi32"/>
<Add library="wsock32"/>
<Add library="opengl32"/>
<Add library="glu32"/>
<Add library="ole32"/>
<Add library="oleaut32"/>
<Add library="uuid"/>
<Add directory="$(WX_DIR)\lib\gcc_lib$(WX_CFG)"/>
</Linker>
<Unit filename="wx_pch.h">
<Option link="0"/>
<Option weight="0"/>
<Option target="default"/>
</Unit>
</Project>
</Code::Blocks_project_file>
Thanks.