Author Topic: wx Build  (Read 7727 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
mingw32-make -f makefile.gcc USE_OPENGL=1 UNICODE=1 MONOLITHIC=1 BUILD=release

Here is my C::B project.

Code: xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="2" />
<Project>
<Option title="wxWidgets Example" />
<Option pch_mode="0" />
<Option compiler="0" />
<Build>
<Target title="default">
<Option output="wxWidgets Example.exe" />
<Option type="0" />
<Option compiler="0" />
<Option includeInTargetAll="1" />
<Option projectResourceIncludeDirsRelation="0" />
</Target>
<Environment>
<Variable name="WX_SUFFIX" value="u" />
</Environment>
</Build>
<Compiler>
<Add option="-pipe" />
<Add option="-mthreads" />
<Add directory="$(#WX.include)" />
<Add directory="$(#WX.lib)\gcc_lib\msw$(WX_SUFFIX)" />
</Compiler>
<Linker>
<Add library="wxmsw26$(WX_SUFFIX)" />
<Add library="wxexpat" />
<Add library="wxzlib" />
<Add library="comctl32" />
<Add library="gdi32" />
<Add library="ole32" />
<Add library="oleaut32" />
<Add library="uuid" />
<Add directory="$(#WX.lib)" />
<Add directory="$(#WX.lib)\gcc_lib" />
</Linker>
<ExtraCommands>
<Add after="zip -j9 resources.zip *.xrc" />
<Mode after="always" />
</ExtraCommands>
<Unit filename="app.cpp">
<Option compilerVar="CPP" />
<Option target="default" />
</Unit>
<Unit filename="app.h">
<Option compilerVar="CPP" />
<Option compile="0" />
<Option link="0" />
<Option target="default" />
</Unit>
<Unit filename="main.cpp">
<Option compilerVar="CPP" />
<Option target="default" />
</Unit>
<Unit filename="main.h">
<Option compilerVar="CPP" />
<Option compile="0" />
<Option link="0" />
<Option target="default" />
</Unit>
<Unit filename="main_menu.xrc">
<Option compilerVar="CPP" />
<Option compile="0" />
<Option link="0" />
<Option target="default" />
</Unit>
</Project>
</CodeBlocks_project_file>
« Last Edit: January 29, 2006, 10:38:01 pm by sethjackson »

takeshimiya

  • Guest
Re: wx Build
« Reply #1 on: January 29, 2006, 10:31:18 pm »
Code: xml
<Add option="-DwxUSE_UNICODE" />
:)

sethjackson

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

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

takeshimiya

  • Guest
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
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="2" />
<Project>
<Option title="wxWidgets Example" />
<Option pch_mode="0" />
<Option compiler="0" />
<Build>
<Target title="default">
<Option output="wxWidgets Example.exe" />
<Option type="0" />
<Option compiler="0" />
<Option includeInTargetAll="1" />
<Option projectResourceIncludeDirsRelation="0" />
</Target>
<Environment>
<Variable name="WX_SUFFIX" value="u" />
</Environment>
</Build>
<Compiler>
<Add option="-pipe" />
<Add option="-mthreads" />
<Add option="-DwxUSE_UNICODE" />
<Add directory="$(#WX.include)" />
<Add directory="$(#WX.lib)\gcc_lib\msw$(WX_SUFFIX)" />
</Compiler>
<Linker>
<Add library="wxmsw26$(WX_SUFFIX)" />
<Add library="wxexpat" />
<Add library="wxzlib" />
<Add library="comctl32" />
<Add library="gdi32" />
<Add library="ole32" />
<Add library="oleaut32" />
<Add library="uuid" />
<Add directory="$(#WX.lib)" />
<Add directory="$(#WX.lib)\gcc_lib" />
</Linker>
<ExtraCommands>
<Add after="zip -j9 resources.zip *.xrc" />
<Mode after="always" />
</ExtraCommands>
<Unit filename="app.cpp">
<Option compilerVar="CPP" />
<Option target="default" />
</Unit>
<Unit filename="app.h">
<Option compilerVar="CPP" />
<Option compile="0" />
<Option link="0" />
<Option target="default" />
</Unit>
<Unit filename="main.cpp">
<Option compilerVar="CPP" />
<Option target="default" />
</Unit>
<Unit filename="main.h">
<Option compilerVar="CPP" />
<Option compile="0" />
<Option link="0" />
<Option target="default" />
</Unit>
<Unit filename="main_menu.xrc">
<Option compilerVar="CPP" />
<Option compile="0" />
<Option link="0" />
<Option target="default" />
</Unit>
</Project>
</CodeBlocks_project_file>

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:

takeshimiya

  • Guest
Re: wx Build
« Reply #6 on: January 29, 2006, 10:40:48 pm »
Code: xml
			<Add option="-D__GNUWIN32__" />
<Add option="-D__WXMSW__" />
<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
			<Add option="-D__GNUWIN32__" />
<Add option="-D__WXMSW__" />
<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:

takeshimiya

  • Guest
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