Code::Blocks Forums

User forums => Help => Topic started by: AlexM on February 10, 2009, 04:00:03 pm

Title: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: AlexM on February 10, 2009, 04:00:03 pm
Hi I'm new to Linux and am trying to setup Code Blocks to compile cross platform c++ using the wxWidgets API. I've managed to get it to compile and work with windows and Visual Studio but am have trouble with Ubuntu and GTK. I've built and configured wxGTK 2.8.9 to my $HOME/opt and have set:
search folders in code blocks to:
and the compiler other options to:
`wx-config  --cflags`

but am still getting the error:
 "No Target! You should use wx-config program for compilation flags!"


Please can someone help as I've been unable to find any solutions on the forums for this specific error and i'm sure its something simple I'm doing wrong.

Thank you!



Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: jens on February 11, 2009, 05:02:01 pm
The problem is moste likely, that you have wxwisgets installed in a non standard directory tree.

Try
Code
wx-config --list
from commandline.

If wx-config is not found, you can put a symlink from
Code
/opt/lib/wx/config/gtk2-unicode-release-2.9
to
Code
/usr/bin/wx-config
.
Replace "gtk2-unicode-release-2.9" with the configuration you want to use as standard.

If you have a wx-config, but your compilation is not listed, try
Code
wx-config --prefix=/opt --list
to see what available.
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: James Edgar on September 08, 2010, 08:17:13 am
I got the same error on a Linux system.  However, `wx-config --cflags` was already defined when the project was setup.  Looking at the code where the error was flagged, there were a number of options including the following:

         !defined(__WXMOTIF__) && \            !defined(__WXMSW__)   && \            !defined(__WXPALMOS__)&& \            !defined(__WXGTK__)   && \

By adding     __WXGTK__  (I assume that is the default)  to the compiler settings defines, I got this error to go away.  Also, once this was done, several libraries had to be added in the linker settings.  These were:

libwx_baseu-2.8.so and libwx_gtk2u_aui-2.8.so

I had expected that `wx-config --libs` would handle this automatically, but apparently it just sets the directories.
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: jens on September 10, 2010, 12:10:18 pm
wx-config --libs does not set compiler-defines,that's done by wx-config --cxxflags.

What's the output of wx-config --list ?
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: James Edgar on September 17, 2010, 07:38:17 am
Jens --

Thank you for replying.  It looks like I must have accidentally hit the use advanced options button during project setup.  As it says, this will create difficulties when compiling without taking the steps listed in my other post.

Thanks,

James

PS -- output of:

wx-config --list

produces:

Default config is gtk2-unicode-release-2.8

Default config will be used for output
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: physnoct on July 18, 2011, 02:44:21 am
For a c++ project using wx-widgets, it seems that the `wx-config --cflags` should be `wx-config --cxxflags` instead.
I had the same problem, and making that change in the compiler options helped it compile further.

JP
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: gintasdx on November 19, 2011, 01:48:46 pm
Thanks James. That solved my problems by compiling simple WxWidgets demo. You also need to link a
libwx_gtk2u_core-2.8 library.
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: VonZorch on December 14, 2013, 05:14:21 am
I had the same problem.  When I put 'wx-config --cxxflags' in compiler other options, I got an invalid command line option error.  What I did was copied the output of it from the terminal to compiler other options.  This got my project  to compile farther.
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: stahta01 on December 14, 2013, 06:04:54 am
I had the same problem.  When I put 'wx-config --cxxflags' in compiler other options, I got an invalid command line option error.  What I did was copied the output of it from the terminal to compiler other options.  This got my project  to compile farther.

You do realize those are supposed to be back ticks NOT the normal single tick/quote!

Tim S.
Title: Re: Linux Error "No Target! You should use wx-config program for compilation flags!"
Post by: floatingCloud on September 18, 2020, 01:33:37 pm
For a c++ project using wx-widgets, it seems that the `wx-config --cflags` should be `wx-config --cxxflags` instead.
I had the same problem, and making that change in the compiler options helped it compile further.

JP
That worked for me too. Thanks :)