Author Topic: Linux Error "No Target! You should use wx-config program for compilation flags!"  (Read 22188 times)

AlexM

  • Guest
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:
  • opt/lib/wx/include/gtk2-ansi-release-2.8
  • opt/include/wx-28
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!




Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
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.

Offline James Edgar

  • Single posting newcomer
  • *
  • Posts: 2
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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
wx-config --libs does not set compiler-defines,that's done by wx-config --cxxflags.

What's the output of wx-config --list ?

Offline James Edgar

  • Single posting newcomer
  • *
  • Posts: 2
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

Offline physnoct

  • Single posting newcomer
  • *
  • Posts: 3
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

Offline gintasdx

  • Single posting newcomer
  • *
  • Posts: 3
    • Developers Diary
Thanks James. That solved my problems by compiling simple WxWidgets demo. You also need to link a
libwx_gtk2u_core-2.8 library.

Offline VonZorch

  • Single posting newcomer
  • *
  • Posts: 4
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

floatingCloud

  • Guest
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 :)