How to use wx-config in Eclipse 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
RobertSimpson
Experienced Solver
Experienced Solver
Posts: 88
Joined: Sat Oct 18, 2008 8:32 pm

How to use wx-config in Eclipse

Post by RobertSimpson »

Not sure if this a WX issue or an Eclipse issue but here goes...

I'm running the latest version (2018-09) of Eclipse in windows 10 using msys2 (like MinGW but newer). I have everything compiling but I would like to use wx-config directly in the linker options rather than having to copy-paste.

On the command line, this works:

Code: Select all

$ g++ -o "simple-wx"  ./app.o ./mainfrm.o ./wnd.o   -lwx_baseu-3.1 -lwx_mswu_core-3.1 -lwx_mswu_gl-3.1 -lwxpng-3.1 -lopengl32  `/msys64/bin/wx-config --libs`
But this does not:

Code: Select all

$ g++ -mwindows `/msys64/bin/wx-config --libs`  -o "simple-wx"  ./app.o ./mainfrm.o ./wnd.o   -lwx_baseu-3.1 -lwx_mswu_core-3.1 -lwx_mswu_gl-3.1 -lwxpng-3.1 -lopengl32
The problem is the latter is what Eclipse generates when you add wx-config, either to the g++ command or to the linker flags. The instructions I'm trying to follow are here: https://wiki.wxwidgets.org/Eclipse although to be honest, I'm very confused what they are actually saying for more recent versions of Eclipse.

So, where should I add wx-config in order to get linking to work? (wx-config appears to work fine in the compiler settings)

Rob.
RobertSimpson
Experienced Solver
Experienced Solver
Posts: 88
Joined: Sat Oct 18, 2008 8:32 pm

Re: How to use wx-config in Eclipse

Post by RobertSimpson »

After some experimenting, it appears it can be made to work by changing the 'Command Line Pattern' in the linker options to

Code: Select all

${COMMAND}  ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${FLAGS}
It is actually mentioned here: https://wiki.wxwidgets.org/Eclipse,_CDT ... etup_Guide (found by a google search) but maybe it would be good if the main documentation was updated.
Post Reply