News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Linker errors with wxRegEx

Started by lifeofgary, January 22, 2009, 11:52:11 PM

Previous topic - Next topic

lifeofgary


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.

stahta01

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
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Quote from: lifeofgary on January 22, 2009, 11:52:11 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
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

lifeofgary


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