Code Generator wxSTC 'undefined reference

CodeLite installation/troubleshooting forum
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Code Generator wxSTC 'undefined reference

Post by 5k3105 »

Everything was working fine. The last thing I remember doing was changing a few widget/control names (in the wxCrafter property editor), then I get compile fail with 33 errors - specifically all the lines having anything to do with my wxSTC. So I closed the workspace, shut everything down, recreated the same setup - and I get the same errors:

Code: Select all

C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 6 -e -f  Makefile"
"----------Building project:[ Demo3 - Debug ]----------"
mingw32-make.exe[1]: Entering directory `C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3'
mingw32-make.exe[1]: Leaving directory `C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3'
mingw32-make.exe[1]: Entering directory `C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3'
codelitegcc g++  -c  "C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/main.cpp" -g -O0 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:/wxWidgets-2.9.5/lib/gcc_dll/mswud -IC:/wxWidgets-2.9.5/include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0  -fno-keep-inline-dllexport   -o ./Debug/main.o -I. -I.
g++ -o ./Debug/Demo3 @"Demo3.txt" -L.    -mthreads -LC:/wxWidgets-2.9.5/lib/gcc_dll -lwxmsw29ud_xrc -lwxmsw29ud_aui -lwxmsw29ud_html -lwxmsw29ud_adv -lwxmsw29ud_core -lwxbase29ud_xml -lwxbase29ud_net -lwxmsw29ud_richtext -lwxbase29ud -lwxtiffd -lwxjpegd -lwxpngd -lwxzlibd -lwxregexud -lwxexpatd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxregexud -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32  -mwindows
./Debug/wxcrafter.o: In function `ZN18MainFrameBaseClassC2EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizel':
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:64: undefined reference to `_imp__wxSTCNameStr'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:64: undefined reference to `_imp___ZN16wxStyledTextCtrlC1EP8wxWindowiRK7wxPointRK6wxSizelRK8wxString'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:66: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginTypeEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:67: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginMaskEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:68: undefined reference to `_imp___ZN16wxStyledTextCtrl18SetMarginSensitiveEib'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:69: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetMarginWidthEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:71: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetPropertyERK8wxStringS2_'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:72: undefined reference to `_imp___ZN16wxStyledTextCtrl12MarkerDefineEiiRK8wxColourS2_'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:73: undefined reference to `_imp___ZN16wxStyledTextCtrl12MarkerDefineEiiRK8wxColourS2_'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:74: undefined reference to `_imp___ZN16wxStyledTextCtrl12MarkerDefineEiiRK8wxColourS2_'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:75: undefined reference to `_imp___ZN16wxStyledTextCtrl12MarkerDefineEiiRK8wxColourS2_'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:76: undefined reference to `_imp___ZN16wxStyledTextCtrl12MarkerDefineEiiRK8wxColourS2_'
./Debug/wxcrafter.o:C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:77: more undefined references to `_imp___ZN16wxStyledTextCtrl12MarkerDefineEiiRK8wxColourS2_' follow
./Debug/wxcrafter.o: In function `ZN18MainFrameBaseClassC2EP8wxWindowiRK8wxStringRK7wxPointRK6wxSizel':
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:80: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetMarginWidthEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:83: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginTypeEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:84: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginMaskEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:85: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetMarginWidthEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:86: undefined reference to `_imp___ZN16wxStyledTextCtrl18SetMarginSensitiveEib'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:89: undefined reference to `_imp___ZN16wxStyledTextCtrl9TextWidthEiRK8wxString'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:90: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginTypeEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:91: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetMarginWidthEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:94: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginTypeEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:95: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginMaskEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:96: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetMarginWidthEii'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:98: undefined reference to `_imp___ZN16wxStyledTextCtrl8SetLexerEi'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:100: undefined reference to `_imp___ZN16wxStyledTextCtrl13StyleClearAllEv'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:101: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetWrapModeEi'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:102: undefined reference to `_imp___ZN16wxStyledTextCtrl20SetIndentationGuidesEi'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:103: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetKeyWordsEiRK8wxString'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:104: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetKeyWordsEiRK8wxString'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:105: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetKeyWordsEiRK8wxString'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:106: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetKeyWordsEiRK8wxString'
C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3/wxcrafter.cpp:107: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetKeyWordsEiRK8wxString'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/Demo3] Error 1
mingw32-make.exe: *** [All] Error 2
Demo3.mk:79: recipe for target `Debug/Demo3' failed
mingw32-make.exe[1]: Leaving directory `C:/Users/5K3105/Documents/CDev_CodeLite52/demo1/Demo3'
Makefile:4: recipe for target `All' failed
33 errors, 0 warnings
After I finished writing this message I tried a third time with the most minimal window setup and it breaks the same way, errors on all the wxSTC lines.
I'm using the latest of CodeLite (5.3) and wxCrafter (1.3), free edition.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by eranif »

When you use wxSTC, you need to tell codelite link against stc.
Open your codelite project settings, navigate to linker -> options

and change the line that says something like this (in debug mode):

Code: Select all

$(shell wx-config --libs --debug=yes)
to

Code: Select all

$(shell wx-config --libs std,stc --debug=yes)

Eran
Make sure you have read the HOW TO POST thread
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by 5k3105 »

Thanks. I never would have known that.

Code completion is not working right for me. Sometimes it works editing MainFrame.cpp, maybe right after I've used wxCrafter, but most times it doesn't. I added
C:\wxWidgets-2.9.5\include
to the Ctags Search Paths and excluded path
C:\wxWidgets-2.9.5\include\wx\univ
. It works fine inside the wxCrafter files I'm not supposed to edit though :/.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by eranif »

5k3105 wrote:Thanks. I never would have known that.
Its a wxWidgets thing, nothing special in codelite / wxCrafter.
5k3105 wrote:to the Ctags Search Paths and excluded path
Hope you did not add it to the "Exclude path" ...

Eran
Make sure you have read the HOW TO POST thread
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by 5k3105 »

It's working now, just not for a richTextCtrl (not styled text).
Its a wxWidgets thing, nothing special in codelite / wxCrafter.
Are there any other controls like that in wxWidgets?
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by eranif »

5k3105 wrote:Are there any other controls like that in wxWidgets?
Yes there are...

Go to your local D:\src\wxWidgets-3.0.0\lib\gcc_dll copy and look at the file suffix.
"std" is a magic string that will add: aui, xrc, html, adv, core, xml, net, base

For wxRichTextCtrl you need to add "richtext"

Eran
Make sure you have read the HOW TO POST thread
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by 5k3105 »

For wxRichTextCtrl you need to add "richtext"
To the linker? It seems to work fine without it. The wxCrafter code ran without anything being linked (in debug mode I guess?) initially (with STC and richtext controls) and then broke when I tried to compile the release for STC only (I think, I can't remember exactly but somewhere along the way it started complaining and needed stc for the linker).

So it compiled fine without 'richtext' added to the linker. I just added it and it still compiles fine.

My question was about the code completion. All controls in my form autocomplete except the richtext control. I even added a special line to the Ctags search path: C:\wxWidgets-2.9.5\include\wx\richtext. Ex: m_richTextCtrl39-> and ctrl-space gives nothing. All other controls autocomplete.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by eranif »

5k3105 wrote:All controls in my form autocomplete except the richtext control
This is probably because of wxWidgets macro: WXDLLIMPEXP_FWD_RICHTEXT
which confuses the parser. Add it to the exclude tokens Settings -> Tags Settings -> CTags -> Advanced
just add new entry there with this token:

Code: Select all

WXDLLIMPEXP_FWD_RICHTEXT
Next, retag your workspace full ( Workspace -> Retag workspace (full))
5k3105 wrote: I even added a special line to the Ctags search path: C:\wxWidgets-2.9.5\include\wx\richtext
Don't start guessing. This line will not help you, because in your code you include wxRichTextCtrl like this:

Code: Select all

#include <wx/richtext/richtextctrl.h>
So codelite only needs the path to the root include folder (which it already has)

Eran
Make sure you have read the HOW TO POST thread
5k3105
CodeLite Enthusiast
Posts: 22
Joined: Tue Sep 17, 2013 11:44 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code Generator wxSTC 'undefined reference

Post by 5k3105 »

Awesome, it's working now. Thank you for clearing this up.
Post Reply