User forums > Help

Problems to make GUI application using wxWidget library to work at first time

(1/2) > >>

studsbr:
Hi all. :D

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:

   
--- Code: (dos) ---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
--- End code ---
   
  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:


--- Code: (dos) ---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

--- End code ---
   

The teste.cbp file contain:

--- Code: (xml) ---<?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 &quot;wx_pch.h&quot;"/>
<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>

--- End code ---

Thanks.

MortenMacFly:

--- Quote from: studsbr on June 16, 2006, 05:36:29 pm ---3) I installed wxWidgets-2.6.3 with "wxMSW-2.6.3-Setup-1.exe" in
   "C:\desenv\wxWidgets-2.6.3\"


--- Code: (xml) ---<?xml version="1.0"?>
<!DOCTYPE Code::Blocks_project_file>
<Code::Blocks_project_file>
<Environment>
<Variable name="WX_DIR" value="C:\wxWidgets-2.6.2"/>
<Variable name="WX_CFG" value=""/>
</Environment>

--- End code ---

--- End quote ---
This is incompatible. Please setup your WX_DIR correctly and try again.
With regards, Morten.

studsbr:
Hello MortenMacFly,

I made the following changes in the "teste.cbp" file:


--- Code: ---<Environment>
        <Variable name="WX_DIR" value="C:\desenv\wxWidgets-2.6.3"/>
<Variable name="WX_CFG" value=""/>
</Environment>

--- End code ---

and


--- Code: ---<Linker>
<Add library="C:\desenv\wxWidgets-2.6.3\lib\gcc_dll\libwxmsw26u.a"/>...
in substitute of:
<Add library="wxmswu"/>...
</Linker>

--- End code ---


I tried compiling and the messages are the same!
I don´t understand what´s happening.

MortenMacFly:
Ok, we have to go a step further. Please enable full command line logging (look at my sig) and post the new compiler log again. Please do a complete rebuild. The vtable issues could also be the result of mixing debbugging enabled object files together with non-debugging enabled ones.
With regards, Morten.

studsbr:
Morten,

that´s all messages with full command line logging enabled and rebuilding all :


--- Code: ---Project   : wxWidgets application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\desenv\projetos\
--------------------------------------------------------------------------------
Switching to target: default
mingw32-g++.exe   -pipe -mthreads -Winvalid-pch -include "wx_pch.h" -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DUSE_PCH -Wall    -IC:\desenv\wxWidgets-2.6.3\include -IC:\desenv\wxWidgets-2.6.3\lib\gcc_lib\mswu -IC:\desenv\wxWidgets-2.6.3\contrib\include  -I"C:\Arquivos de programas\CodeBlocks\include" -c wx_pch.h -o wx_pch.h.gch
mingw32-g++.exe   -pipe -mthreads -Winvalid-pch -include "wx_pch.h" -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DUSE_PCH -Wall    -IC:\desenv\wxWidgets-2.6.3\include -IC:\desenv\wxWidgets-2.6.3\lib\gcc_lib\mswu -IC:\desenv\wxWidgets-2.6.3\contrib\include  -I"C:\Arquivos de programas\CodeBlocks\include" -c main.cpp -o .objs\main.o
mingw32-g++.exe   -pipe -mthreads -Winvalid-pch -include "wx_pch.h" -D__GNUWIN32__ -D__WXMSW__ -DwxUSE_UNICODE -DUSE_PCH -Wall    -IC:\desenv\wxWidgets-2.6.3\include -IC:\desenv\wxWidgets-2.6.3\lib\gcc_lib\mswu -IC:\desenv\wxWidgets-2.6.3\contrib\include  -I"C:\Arquivos de programas\CodeBlocks\include" -c app.cpp -o .objs\app.o
mingw32-g++.exe   -LC:\desenv\wxWidgets-2.6.3\lib\gcc_lib  -L"C:\Arquivos de programas\CodeBlocks\lib" -o C:\desenv\projetos\teste.exe .objs\main.o .objs\app.o        C:\desenv\wxWidgets-2.6.3\lib\gcc_dll\libwxmsw26u.a -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid  -mwindows
Info: resolving wxFrame::sm_eventTable       by linking to __imp___ZN7wxFrame13sm_eventTableE (auto-import)
Info: resolving _wxFrameNameStr by linking to __imp__wxFrameNameStr (auto-import)
Info: resolving _wxDefaultSize by linking to __imp__wxDefaultSize (auto-import)
Info: resolving _wxDefaultPosition by linking to __imp__wxDefaultPosition (auto-import)
Info: resolving vtable for wxMenuby linking to __imp___ZTV6wxMenu (auto-import)
Info: resolving vtable for wxMenuBaseby linking to __imp___ZTV10wxMenuBase (auto-import)
Info: resolving vtable for wxListBaseby linking to __imp___ZTV10wxListBase (auto-import)
Info: resolving vtable for wxObjectby linking to __imp___ZTV8wxObject (auto-import)
Info: resolving _wxEmptyString by linking to __imp__wxEmptyString (auto-import)
Info: resolving vtable for wxFrameby linking to __imp___ZTV7wxFrame (auto-import)
Info: resolving wxStringBase::npos       by linking to __imp___ZN12wxStringBase4nposE (auto-import)
Info: resolving _wxEVT_COMMAND_MENU_SELECTED by linking to __imp__wxEVT_COMMAND_MENU_SELECTED (auto-import)
Info: resolving _wxEVT_NULL by linking to __imp__wxEVT_NULL (auto-import)
Info: resolving vtable for wxwxMenuItemListNodeby linking to __imp___ZTV20wxwxMenuItemListNode (auto-import)
Info: resolving wxAppConsole::ms_appInstance        by linking to __imp___ZN12wxAppConsole14ms_appInstanceE (auto-import)
Info: resolving wxAppConsole::ms_appInitFn        by linking to __imp___ZN12wxAppConsole12ms_appInitFnE (auto-import)
Info: resolving _wxTopLevelWindows by linking to __imp__wxTopLevelWindows (auto-import)
.objs\main.o:main.cpp:(.text$_ZN6wxMenuC1ERK8wxStringl[wxMenu::wxMenu(wxString const&, long)]+0x5a): variable 'vtable for wxMenu' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN10wxMenuBaseC2ERK8wxStringl[wxMenuBase::wxMenuBase(wxString const&, long)]+0x4c): variable 'vtable for wxMenuBase' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN10wxListBaseC2E9wxKeyType[wxListBase::wxListBase(wxKeyType)]+0x45): variable 'vtable for wxListBase' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN8wxObjectD2Ev[wxObject::~wxObject()]+0xb): variable 'vtable for wxObject' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN8wxObjectC2Ev[wxObject::wxObject()]+0x8): variable 'vtable for wxObject' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN7wxFrameC2EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizelS4_[wxFrame::wxFrame(wxWindow*, int, wxString const&, wxPoint const&, wxSize const&, long, wxString const&)]+0x4c): variable 'vtable for wxFrame' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
.objs\main.o:main.cpp:(.text$_ZN20wxwxMenuItemListNodeC1EP10wxListBasePS_S2_P10wxMenuItemRK9wxListKey[wxwxMenuItemListNode::wxwxMenuItemListNode(wxListBase*, wxwxMenuItemListNode*, wxwxMenuItemListNode*, wxMenuItem*, wxListKey const&)]+0x39): variable 'vtable for wxwxMenuItemListNode' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 23 seconds)
0 errors, 0 warnings

--- End code ---

With regards, Studsbr

Navigation

[0] Message Index

[#] Next page

Go to full version