Code::Blocks Forums

User forums => Help => Topic started by: lifeofgary on January 22, 2009, 11:52:11 pm

Title: Linker errors with wxRegEx
Post by: lifeofgary on January 22, 2009, 11:52:11 pm

I'm uncertain where the best place to post this is.  Forgive me if this isn't the best place and please guide me.

I'm using CodeBlocks.  When I include the statements:

  #include <wx/regex.h>
  wxRegEx reEmail;

When I try to compile I get the following linker errors:

=== WxTest Debug ====
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0x84)||undefined reference to `_wx_regfree'|
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0xd4)||undefined reference to `_wx_regfree'|
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0x153)||undefined reference to `_wx_regerror'|
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0x18d)||undefined reference to `_wx_regerror'|
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0x3a9)||undefined reference to `_wx_re_comp'|
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0x45e)||undefined reference to `_wx_regfree'|
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0x6bd)||undefined reference to `_wx_re_exec'|
||=== Build finished: 7 errors, 0 warnings ===|

I've built wxWidgets with Mingw with the following style of command

mingw32-make -f makefile.gcc USE_XRC=1 SHARED=0 MONOLITHIC=1 BUILD=release UNICODE=0

So far it works for everything but regular expressions.
Title: Re: Linker errors with wxRegEx
Post by: stahta01 on January 23, 2009, 03:32:32 pm
Add an link to library wxregex, wxregexu, wxregexud, or wxregexd. The u means Unicode the d means debug.
If not Unicode, I would start with wxregex and then try wxregexd.
If Unicode, I would start with wxregexu and then try wxregexud.

Tim S
Title: Re: Linker errors with wxRegEx
Post by: stahta01 on January 23, 2009, 03:35:36 pm
lib\gcc_lib\libwxmsw28u.a(monolib_regex.o):regex.cpp:(.text+0x84)||undefined reference to `_wx_regfree'|
...
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=0 MONOLITHIC=1 BUILD=release UNICODE=0

The "gcc_lib\libwxmsw28u.a" means Static Unicode; but, UNICODE=0 means NOT Unicode.
Which are you really using?

Tim S
Title: Re: Linker errors with wxRegEx
Post by: lifeofgary on January 23, 2009, 06:32:28 pm

Thank you Tim!  I'm glad it was something simple, but I never would have figured out how to fix it.

I've compiled both with and without unicode.  I have libraries for both.  I thought I was building without unicode, but adding the unicode library fixed the issue.  I'm pleased.  I can handle it from here.

For the archives, in case anyone else has this problem.

In CodeBlocks

Settings->Compiler and debugger->Linker Settings
Under link Libraries click the 'Add' Button
Select the file 'lib\gcc_lib\libwxregexu.a'
'Ok'
'Ok'
Rebuild