Codelite 4.1 - linking with wxStyledTextCtrl

CodeLite installation/troubleshooting forum
ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

Codelite 4.1 - linking with wxStyledTextCtrl

Post by ColinTaylor » Thu Aug 30, 2012 12:34 pm

On Windows XP

Having upgraded to the latest Codelite 4.1 (using install file codelite-4.1.5770-mingw4.6.1-wx2.9.4.exe), most projects recompile/link with no issues.

However I have a few projects where the wxStyledTextCtrl component is used and I can't get these to link. Typical build output is as follows

----------Building project:[ WxRequirementsChecker - Debug ]----------
mingw32-make.exe[1]: Entering directory `D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker'
windres -i "D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/resources.rc" --use-temp-file --define __WXMSW__ --define _UNICODE --include-dir C:\wxWidgets-2.9.4\lib\gcc_dll\mswu --include-dir C:\wxWidgets-2.9.4\include --define WXUSINGDLL -o ./Debug/resources.rc.o
g++ -c "D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/gui.cpp" -g -O0 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.9.4\lib\gcc_dll\mswud -IC:\wxWidgets-2.9.4\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -D__WX__ -o ./Debug/gui.o -I. -I"D:\CodeLiteWorkspaces\ActiveProjects"/WxReusablesLib
g++ -c "D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp" -g -O0 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.9.4\lib\gcc_dll\mswud -IC:\wxWidgets-2.9.4\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -D__WX__ -o ./Debug/main.o -I. -I"D:\CodeLiteWorkspaces\ActiveProjects"/WxReusablesLib
g++ -c "D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/RequirementsExtractor.cpp" -g -O0 -Wall -mthreads -DHAVE_W32API_H -D__WXMSW__ -D__WXDEBUG__ -D_UNICODE -IC:\wxWidgets-2.9.4\lib\gcc_dll\mswud -IC:\wxWidgets-2.9.4\include -DWXUSINGDLL -Wno-ctor-dtor-privacy -pipe -fmessage-length=0 -fno-keep-inline-dllexport -D__WX__ -o ./Debug/RequirementsExtractor.o -I. -I"D:\CodeLiteWorkspaces\ActiveProjects"/WxReusablesLib
g++ -o ./Debug/WxRequirementsChecker @"D:\CodeLiteWorkspaces\ActiveProjects\WxRequirementsChecker\WxRequirementsChecker.txt" -L. -L../WxReusablesLib/Debug -lWxReusablesLib -mwindows -mthreads -LC:\wxWidgets-2.9.4\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
./Debug/main.o: In function `ZN9MainFrame14SetResultsFontER6wxFont':
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:330: undefined reference to `_imp___ZN16wxStyledTextCtrl12StyleSetFontEiR6wxFont'
./Debug/main.o: In function `ZN9MainFrame16SetResultsColourERK8wxColour':
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:336: undefined reference to `_imp___ZN16wxStyledTextCtrl18StyleSetBackgroundEiRK8wxColour'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:339: undefined reference to `_imp___ZN16wxStyledTextCtrl18StyleSetBackgroundEiRK8wxColour'
./Debug/main.o: In function `ZN9MainFrame24CreateAdditionalGUIItemsEv':
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:351: undefined reference to `_imp__wxSTCNameStr'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:351: undefined reference to `_imp___ZN16wxStyledTextCtrlC1EP8wxWindowiRK7wxPointRK6wxSizelRK8wxString'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:354: undefined reference to `_imp___ZN16wxStyledTextCtrl13StyleClearAllEv'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:355: undefined reference to `_imp___ZN16wxStyledTextCtrl8SetLexerEi'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:356: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetKeyWordsEiRK8wxString'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:357: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetKeyWordsEiRK8wxString'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:358: undefined reference to `_imp___ZN16wxStyledTextCtrl16SetSelBackgroundEbRK8wxColour'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:359: undefined reference to `_imp___ZN16wxStyledTextCtrl16SetSelForegroundEbRK8wxColour'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:361: undefined reference to `_imp___ZN16wxStyledTextCtrl10SetEOLModeEi'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:362: undefined reference to `_imp___ZN16wxStyledTextCtrl11SetWrapModeEi'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:363: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetMarginWidthEii'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:364: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetMarginWidthEii'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:365: undefined reference to `_imp___ZN16wxStyledTextCtrl25SetUseHorizontalScrollBarEb'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:366: undefined reference to `_imp___ZN16wxStyledTextCtrl23SetUseVerticalScrollBarEb'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:367: undefined reference to `_imp___ZN16wxStyledTextCtrl13SetMarginLeftEi'
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/main.cpp:370: undefined reference to `_imp___ZN16wxStyledTextCtrl14SetExtraAscentEi'
./Debug/RequirementsExtractor.o: In function `ZN22CRequirementsExtractor7DisplayEP16wxStyledTextCtrl':
D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker/RequirementsExtractor.cpp:107: undefined reference to `_imp___ZN16wxStyledTextCtrl8ClearAllEv'
collect2: ld returned 1 exit status
mingw32-make.exe[1]: *** [Debug/WxRequirementsChecker] Error 1
WxRequirementsChecker.mk:76: recipe for target `Debug/WxRequirementsChecker' failed
mingw32-make.exe[1]: Leaving directory `D:/CodeLiteWorkspaces/ActiveProjects/WxRequirementsChecker'
mingw32-make.exe: *** [All] Error 2
ActiveProjects_wsp.mk:4: recipe for target `All' failed
----------Build Ended----------
20 errors, 0 warnings, total time: 00:00:19 seconds


So far I've tried the following linker options, none have worked ...

-mwindows;$(shell wx-config --debug=yes --libs --unicode=yes)
-mwindows;$(shell wx-config --debug=yes --libs stc --unicode=yes)
-mwindows;$(shell wx-config --debug=yes --libs wxstc --unicode=yes)
-mwindows;$(shell wx-config --debug=yes --libs core;base;adv;stc --unicode=yes)

I've also tried the usual full retag of the workspace, cleaning allprojects but this hasn't worked either.

Please can someone suggest what options I need?

Many thanks, Colin

User avatar
eranif
CodeLite Plugin
Posts: 5924
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by eranif » Thu Aug 30, 2012 12:54 pm

Can you please open a shell from within codeltie (right click on the tab of any open editor inside codelite)
in the opened tab, type:

Code: Select all

wx-config --libs std,stc
What is the output ?

Eran
Make sure you have read the HOW TO POST thread

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by ColinTaylor » Thu Aug 30, 2012 1:16 pm

Running "Shell at Filepath" opened a command window

Running "wx-config --libs std,stc" gave the following output

-mthreads -LC:\wxWidgets-2.9.4\lib\gcc_dll -lwxmsw29u_stc -lwxmsw29u_xrc -lwxmsw29u_aui -lwxmsw29u_html -lwxmsw29u_adv -lwxmsw29u_core -lwxbase29u_xm
l -lwxbase29u_net -lwxmsw29u_richtext -lwxbase29u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxr
egexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32

Colin

User avatar
eranif
CodeLite Plugin
Posts: 5924
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by eranif » Thu Aug 30, 2012 3:47 pm

ColinTaylor wrote:-mthreads -LC:\wxWidgets-2.9.4\lib\gcc_dll -lwxmsw29u_stc -lwxmsw29u_xrc -lwxmsw29u_aui -lwxmsw29u_html -lwxmsw29u_adv -lwxmsw29u_core -lwxbase29u_xm
l -lwxbase29u_net -lwxmsw29u_richtext -lwxbase29u -lwxtiff -lwxjpeg -lwxpng -lwxzlib -lwxregexu -lwxexpat -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwxr
egexu -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32
This looks like the correct link line to me (I can see stc here)

Did you try using this one (note that I am using comma separated list, while you used semi-colon list)

Eran
Make sure you have read the HOW TO POST thread

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by ColinTaylor » Thu Aug 30, 2012 4:39 pm

I've just tried each of the following as the linker options ...

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

... and neither of them worked.

Here's the linker build output, and I can't see stc in there ...

g++ -o ./Debug/WxRequirementsChecker @"D:\CodeLiteWorkspaces\ActiveProjects\WxRequirementsChecker\WxRequirementsChecker.txt" -L. -L../WxReusablesLib/Debug -lWxReusablesLib -mwindows -mthreads -LC:\wxWidgets-2.9.4\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

I agree that running "wx-config --libs std,stc" does show stc.

BTW I've used semi-colon as the library separator on Ubuntu with no problems, haven't needed to use the separator on Windows until now ;)

User avatar
eranif
CodeLite Plugin
Posts: 5924
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by eranif » Thu Aug 30, 2012 4:45 pm

you are still making the same mistake: you should use comma separated list not semi colon list of modules.
--libs std,etc Not --libs std;etc

Eran
Make sure you have read the HOW TO POST thread

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by ColinTaylor » Thu Aug 30, 2012 4:59 pm

Eran, please re-read the first few lines of my my previous post ...
I've just tried each of the following as the linker options ...

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

... and neither of them worked.
Colin

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by ColinTaylor » Thu Aug 30, 2012 5:11 pm

For what its worth, running the linker command (with -lwxmsw29ud_stc added manually) from the command line does work, and does generate a usable executable.

The full command line is thus ...

g++ -o ./Debug/WxRequirementsChecker @"D:\CodeLiteWorkspaces\ActiveProjects\WxRequirementsChecker\WxRequirementsChecker.txt" -L. -L../WxReusablesLib/Debug -lWxReusablesLib -mwindows -mthreads -LC:\wxWidgets-2.9.4\lib\gcc_dll -lwxmsw29ud_stc -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 -lcom
ctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32

To me the issue is that adding "--libs std,stc" to the linker options does not result in the "-lwxmsw29ud_stc" being set in the resultant linker command.

I've also created a minimal example that includes the wxStyledTextCtrl component and it too fails to link.

User avatar
eranif
CodeLite Plugin
Posts: 5924
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by eranif » Thu Aug 30, 2012 5:16 pm

So you are saying that when you are running from the terminal:
wx-config --libs std,stc it works as expected, while from within codelite, it fails?

can you type from the terminal:

Code: Select all

which wx-config
?

Also, can you please post here the content of your environment variable table from settings -> environment variables?

My guess is that there is a rogue wx-config somewhere... (wx-config was updated in this release, I fixed several bugs in it, including not honoring the list of modules)
The one from the command line is the correct one, while the other that codelite uses, is the old one

Eran
Make sure you have read the HOW TO POST thread

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Codelite 4.1 - linking with wxStyledTextCtrl

Post by ColinTaylor » Thu Aug 30, 2012 5:23 pm

Yes, running the linker from the command-line works, but running the linker from within codelite does not.

Running "which wx-config" produces output "C:/CodeLite/wx-config.EXE"

Clicking "Settings -> Environment variables" produces

CodeLiteDir=C:\CodeLite
WXWIN=C:\wxWidgets-2.9.4
PATH=$(WXWIN)\lib\gcc_dll;$(PATH)
WXCFG=gcc_dll\mswu
UNIT_TEST_PP_SRC_DIR=C:\UnitTest++-1.3

Colin

Post Reply