Author Topic: wx Build  (Read 5122 times)

sethjackson

  • Guest
wx Build
« on: January 29, 2006, 10:27:16 pm »
Hi I have this linker error.

Quote
-------------- Build: default in wxWidgets Example ---------------
Compiling: main.cpp
Compiling: app.cpp
Linking executable: wxWidgets Example.exe
.objs\main.o:main.cpp:(.text$_ZN12wxStringBaseC2EPKc[wxStringBase::wxStringBase(char const*)]+0x25): undefined reference to `wxStringBase::InitWith(char const*, unsigned int, unsigned int)'
.objs\main.o:main.cpp:(.text$_Z16wxGetTranslationPKc[wxGetTranslation(char const*)]+0x2a): undefined reference to `wxLocale::GetString(char const*, char const*) const'
.objs\app.o:app.cpp:(.rdata$_ZTV19wxWidgetsExampleApp[vtable for wxWidgetsExampleApp]+0x68): undefined reference to `wxApp::Initialize(int&, char**)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 26 seconds)
0 errors, 0 warnings


I don't know what is wrong. I have a static lib build of wx.

I built wx with this

Code: DOS
  1. mingw32-make -f makefile.gcc USE_OPENGL=1 UNICODE=1 MONOLITHIC=1 BUILD=release
  2.  

Here is my C::B project.

Code: XML
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  2. <CodeBlocks_project_file>
  3.         <FileVersion major="1" minor="2" />
  4.         <Project>
  5.                 <Option title="wxWidgets Example" />
  6.                 <Option pch_mode="0" />
  7.                 <Option compiler="0" />
  8.                 <Build>
  9.                         <Target title="default">
  10.                                 <Option output="wxWidgets Example.exe" />
  11.                                 <Option type="0" />
  12.                                 <Option compiler="0" />
  13.                                 <Option includeInTargetAll="1" />
  14.                                 <Option projectResourceIncludeDirsRelation="0" />
  15.                         </Target>
  16.                         <Environment>
  17.                                 <Variable name="WX_SUFFIX" value="u" />
  18.                         </Environment>
  19.                 </Build>
  20.                 <Compiler>
  21.                         <Add option="-pipe" />
  22.                         <Add option="-mthreads" />
  23.                         <Add directory="$(#WX.include)" />
  24.                         <Add directory="$(#WX.lib)\gcc_lib\msw$(WX_SUFFIX)" />
  25.                 </Compiler>
  26.                 <Linker>
  27.                         <Add library="wxmsw26$(WX_SUFFIX)" />
  28.                         <Add library="wxexpat" />
  29.                         <Add library="wxzlib" />
  30.                         <Add library="comctl32" />
  31.                         <Add library="gdi32" />
  32.                         <Add library="ole32" />
  33.                         <Add library="oleaut32" />
  34.                         <Add library="uuid" />
  35.                         <Add directory="$(#WX.lib)" />
  36.                         <Add directory="$(#WX.lib)\gcc_lib" />
  37.                 </Linker>
  38.                 <ExtraCommands>
  39.                         <Add after="zip -j9 resources.zip *.xrc" />
  40.                         <Mode after="always" />
  41.                 </ExtraCommands>
  42.                 <Unit filename="app.cpp">
  43.                         <Option compilerVar="CPP" />
  44.                         <Option target="default" />
  45.                 </Unit>
  46.                 <Unit filename="app.h">
  47.                         <Option compilerVar="CPP" />
  48.                         <Option compile="0" />
  49.                         <Option link="0" />
  50.                         <Option target="default" />
  51.                 </Unit>
  52.                 <Unit filename="main.cpp">
  53.                         <Option compilerVar="CPP" />
  54.                         <Option target="default" />
  55.                 </Unit>
  56.                 <Unit filename="main.h">
  57.                         <Option compilerVar="CPP" />
  58.                         <Option compile="0" />
  59.                         <Option link="0" />
  60.                         <Option target="default" />
  61.                 </Unit>
  62.                 <Unit filename="main_menu.xrc">
  63.                         <Option compilerVar="CPP" />
  64.                         <Option compile="0" />
  65.                         <Option link="0" />
  66.                         <Option target="default" />
  67.                 </Unit>
  68.         </Project>
  69. </CodeBlocks_project_file>
  70.  
« Last Edit: January 29, 2006, 10:38:01 pm by sethjackson »

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: wx Build
« Reply #1 on: January 29, 2006, 10:31:18 pm »
Code: XML
  1. <Add option="-DwxUSE_UNICODE" />
:)

sethjackson

  • Guest
Re: wx Build
« Reply #2 on: January 29, 2006, 10:34:20 pm »
Code: XML
  1. <Add option="-DwxUSE_UNICODE" />
:)

Nope sorry I already tried that.  :P Lemme try again tho....

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: wx Build
« Reply #3 on: January 29, 2006, 10:35:15 pm »
Believe me, if you compiled in Unicode mode, you need to define wxUSE_UNICODE in your app.

EDIT: BTW, you compiled with MONOLIITHIC=1??? :lol: (note the two II)
« Last Edit: January 29, 2006, 10:37:14 pm by Takeshi Miya »

sethjackson

  • Guest
Re: wx Build
« Reply #4 on: January 29, 2006, 10:37:18 pm »
And again

Quote
-------------- Build: default in wxWidgets Example ---------------
Linking executable: wxWidgets Example.exe
.objs\main.o:main.cpp:(.text$_ZN12wxStringBaseC2EPKc[wxStringBase::wxStringBase(char const*)]+0x25): undefined reference to `wxStringBase::InitWith(char const*, unsigned int, unsigned int)'
.objs\main.o:main.cpp:(.text$_Z16wxGetTranslationPKc[wxGetTranslation(char const*)]+0x2a): undefined reference to `wxLocale::GetString(char const*, char const*) const'
.objs\app.o:app.cpp:(.rdata$_ZTV19wxWidgetsExampleApp[vtable for wxWidgetsExampleApp]+0x68): undefined reference to `wxApp::Initialize(int&, char**)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 23 seconds)
0 errors, 0 warnings

Code: XML
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  2. <CodeBlocks_project_file>
  3.         <FileVersion major="1" minor="2" />
  4.         <Project>
  5.                 <Option title="wxWidgets Example" />
  6.                 <Option pch_mode="0" />
  7.                 <Option compiler="0" />
  8.                 <Build>
  9.                         <Target title="default">
  10.                                 <Option output="wxWidgets Example.exe" />
  11.                                 <Option type="0" />
  12.                                 <Option compiler="0" />
  13.                                 <Option includeInTargetAll="1" />
  14.                                 <Option projectResourceIncludeDirsRelation="0" />
  15.                         </Target>
  16.                         <Environment>
  17.                                 <Variable name="WX_SUFFIX" value="u" />
  18.                         </Environment>
  19.                 </Build>
  20.                 <Compiler>
  21.                         <Add option="-pipe" />
  22.                         <Add option="-mthreads" />
  23.                         <Add option="-DwxUSE_UNICODE" />
  24.                         <Add directory="$(#WX.include)" />
  25.                         <Add directory="$(#WX.lib)\gcc_lib\msw$(WX_SUFFIX)" />
  26.                 </Compiler>
  27.                 <Linker>
  28.                         <Add library="wxmsw26$(WX_SUFFIX)" />
  29.                         <Add library="wxexpat" />
  30.                         <Add library="wxzlib" />
  31.                         <Add library="comctl32" />
  32.                         <Add library="gdi32" />
  33.                         <Add library="ole32" />
  34.                         <Add library="oleaut32" />
  35.                         <Add library="uuid" />
  36.                         <Add directory="$(#WX.lib)" />
  37.                         <Add directory="$(#WX.lib)\gcc_lib" />
  38.                 </Linker>
  39.                 <ExtraCommands>
  40.                         <Add after="zip -j9 resources.zip *.xrc" />
  41.                         <Mode after="always" />
  42.                 </ExtraCommands>
  43.                 <Unit filename="app.cpp">
  44.                         <Option compilerVar="CPP" />
  45.                         <Option target="default" />
  46.                 </Unit>
  47.                 <Unit filename="app.h">
  48.                         <Option compilerVar="CPP" />
  49.                         <Option compile="0" />
  50.                         <Option link="0" />
  51.                         <Option target="default" />
  52.                 </Unit>
  53.                 <Unit filename="main.cpp">
  54.                         <Option compilerVar="CPP" />
  55.                         <Option target="default" />
  56.                 </Unit>
  57.                 <Unit filename="main.h">
  58.                         <Option compilerVar="CPP" />
  59.                         <Option compile="0" />
  60.                         <Option link="0" />
  61.                         <Option target="default" />
  62.                 </Unit>
  63.                 <Unit filename="main_menu.xrc">
  64.                         <Option compilerVar="CPP" />
  65.                         <Option compile="0" />
  66.                         <Option link="0" />
  67.                         <Option target="default" />
  68.                 </Unit>
  69.         </Project>
  70. </CodeBlocks_project_file>
  71.  

sethjackson

  • Guest
Re: wx Build
« Reply #5 on: January 29, 2006, 10:37:48 pm »
Believe me, if you compiled in Unicode mode, you need to define wxUSE_UNICODE in your app.

EDIT: BTW, you compiled with MONOLIITHIC=1??? :lol: (note the two II)

:lol: Not..... Fixed in my post. :lol:

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: wx Build
« Reply #6 on: January 29, 2006, 10:40:48 pm »
Code: XML
  1.                         <Add option="-D__GNUWIN32__" />
  2.                         <Add option="-D__WXMSW__" />
  3.                         <Add option="-DHAVE_W32API_H" />
?

BTW, those linker errors are usually Unicode problems.

sethjackson

  • Guest
Re: wx Build
« Reply #7 on: January 29, 2006, 10:42:09 pm »
Code: XML
  1.                         <Add option="-D__GNUWIN32__" />
  2.                         <Add option="-D__WXMSW__" />
  3.                         <Add option="-DHAVE_W32API_H" />
?

BTW, those linker errors are usually Unicode problems.

I didn't need to add those. It worked (after adding wxUSE_UNICODE) when I did Build -> Clean. Then I rebuilt and it works. Thanks Takeshi Miya.  :D You were right sorry.  :oops:

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: wx Build
« Reply #8 on: January 29, 2006, 10:48:05 pm »
I'm glad it worked. :)

sethjackson

  • Guest
Re: wx Build
« Reply #9 on: January 29, 2006, 11:27:53 pm »
I'm glad it worked. :)

Me too. Thanks again.  :D