wxStyledTextCtrl undefined reference Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
xionovermazes
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Jul 20, 2015 6:14 pm

wxStyledTextCtrl undefined reference

Post by xionovermazes »

Hello, I want to use wxStyledTextCtrl in my project, but the compiler returned error :

Code: Select all

 undefined reference to `wxSTCNameStr'|
undefined reference to `wxStyledTextCtrl::wxStyledTextCtrl(wxWindow*, int, wxPoint const&, wxSize const&, long, wxString const&)'|
wxSTCNameStr is default value to last arg. The first idea to sollute this problem was to compile wxwidgets from sources and link the libwxscintilla-3.0.a. But it doest not work after this. Help meee
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxStyledTextCtrl undefined reference

Post by DavidHart »

Hi,

I presume you're now using 'wx-config --libs' to provide the linker flags. Good, except it's not good enough for wx3.0 when you want to link to the non-standard libs like that one.

If it's only wxStyledTextCtrl that you need as an extra, you need to do:
wx-config --libs std,stl

Alternatively 'wx-config --libs all' will do what it sounds like.

Regards,

David
xionovermazes
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Jul 20, 2015 6:14 pm

Re: wxStyledTextCtrl undefined reference

Post by xionovermazes »

G++ give me this :
ld||cannot find -lwx_gtk2u_all-2.8|
:(
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxStyledTextCtrl undefined reference

Post by DavidHart »

Ah, I forgot you're still using wx2.8 (why?)

For 2.8 you need to build wxStyledTextCtrl separately. It's in gtk-build/contrib/ . Just run the makefile in that dir, or the standalone one in gtk-build/contrib/src/stc. Then I think you'll need to run make install again in gtk-build.
xionovermazes
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Jul 20, 2015 6:14 pm

Re: wxStyledTextCtrl undefined reference

Post by xionovermazes »

So i have recently installed libwxgtk3.0-dev and headers. And now g++ returned :
ld||cannot find -lwx_gtk2u_media-3.0|
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxStyledTextCtrl undefined reference

Post by DavidHart »

The 'media' lib is often packaged separately. Search for libwx* and you'll probably find libwxgtk-media3.0-dev.
xionovermazes
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Jul 20, 2015 6:14 pm

Re: wxStyledTextCtrl undefined reference

Post by xionovermazes »

Image I beware.
xionovermazes
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Jul 20, 2015 6:14 pm

Re: wxStyledTextCtrl undefined reference

Post by xionovermazes »

(Yes i moved to xubuntu) I clicked install anyway, and now i have no libs, and tons of erros
Last edited by xionovermazes on Mon Aug 03, 2015 2:08 pm, edited 1 time in total.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxStyledTextCtrl undefined reference

Post by DavidHart »

I can only guess that your system has more than one type of wx lib that can be installed e.g. openSUSE has a normal wx3 one, and a stl one, and one that uses gtk3 instead of gtk2. That gets confusing!

You need to install a single type of libwxgtk*-dev and libwxgtk-media*-dev, plus their dependencies. Try uninstalling what you have, then click those 2, both of the same type.
xionovermazes
Earned a small fee
Earned a small fee
Posts: 17
Joined: Mon Jul 20, 2015 6:14 pm

Re: wxStyledTextCtrl undefined reference

Post by xionovermazes »

Yes u are right, i didnot purged wx2.8 packages...i will try to reinstall
Post Reply