Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code::Blocks WxWidget error - No Target! You should use wx-config program for compilation flags?

I can't get the default WxWidget template that comes with Code::Blocks to compile. The error I receive is error "No Target! You should use wx-config program for compilation flags! (amongst others)

Google led me to some links but I can't seem to figure it out

One similar thread I found; http://forums.codeblocks.org/index.php?topic=10122.0

"The problem is moste likely, that you have wxwisgets installed in a non standard directory tree."

wx-config --list

Reports:

wxconf

wx-config --prefix=/opt --list

Reports:

wxconfpreopt

Is this correct? I can't tell.

Another similar thread; http://www.justlinux.com/forum/archive/index.php/t-105554.html

The person in that topic ended up adding g++ 'wx-config --cflags' -o wxTest wxTest.cpp as a compilation/linking flag but I tried adding that to "Linker Settings -> Other linker options" in Code::Blocks and it doesn't seem to do anything.

Linker:

linkopts

Includes:

inclds

I find this whole linker business extremely confusing and I can't figure out where I'm going wrong on this.

Full error list:

/var/wxWidgets-2.8.12/include/wx/defs.h|42|error: #error "No Target! You should use wx-config program for compilation flags!"|
/var/wxWidgets-2.8.12/include/wx/gtk/cursor.h|40|error: ISO C++ forbids declaration of ‘GdkCursor’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/cursor.h|40|error: expected ‘;’ before ‘*’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/app.h|55|error: ‘guint’ does not name a type|
/var/wxWidgets-2.8.12/include/wx/gtk/app.h|65|error: ISO C++ forbids declaration of ‘GdkVisual’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/app.h|65|error: expected ‘;’ before ‘*’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/colour.h|26|error: ISO C++ forbids declaration of ‘GdkColor’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/colour.h|26|error: expected ‘,’ or ‘...’ before ‘&’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/colour.h|42|error: ‘GdkColormap’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/colour.h|45|error: ISO C++ forbids declaration of ‘GdkColor’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/colour.h|45|error: expected ‘;’ before ‘*’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/region.h|59|error: expected ‘)’ before ‘*’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/region.h|61|error: ISO C++ forbids declaration of ‘GdkRegion’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/region.h|61|error: expected ‘;’ before ‘*’ token|
/var/wxWidgets-2.8.12/include/wx/window.h|1133|error: ‘WXWidget’ does not name a type|
/var/wxWidgets-2.8.12/include/wx/window.h|1135|error: ‘WXWidget’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/window.h|1293|error: field ‘m_palette’ has incomplete type|
/var/wxWidgets-2.8.12/include/wx/window.h||In member function ‘wxPalette wxWindowBase::GetPalette() const’:|
/var/wxWidgets-2.8.12/include/wx/window.h|1142|error: return type ‘struct wxPalette’ is incomplete|
/var/wxWidgets-2.8.12/include/wx/window.h|1142|error: ‘m_palette’ was not declared in this scope|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: expected initializer before ‘*’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ was not declared in this scope|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: typedef ‘CMPFUNC_wxArraywxArrayGdkWindows’ is initialized (use decltype instead)|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ was not declared in this scope|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘pItem1’ was not declared in this scope|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ was not declared in this scope|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘pItem2’ was not declared in this scope|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ISO C++ forbids declaration of ‘_wxArraywxArrayGdkWindows’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: expected ‘;’ before ‘&’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: expected ‘;’ before ‘_wxArraywxArrayGdkWindows’|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ISO C++ forbids declaration of ‘_wxArraywxArrayGdkWindows’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: expected ‘;’ before ‘&’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: expected ‘;’ before ‘_wxArraywxArrayGdkWindows’|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ISO C++ forbids declaration of ‘_wxArraywxArrayGdkWindows’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: expected ‘;’ before ‘&’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: expected ‘;’ before ‘int’|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘CMPFUNC_wxArraywxArrayGdkWindows’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ does not name a type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ does not name a type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|19|error: ‘_wxArraywxArrayGdkWindows’ does not name a type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|132|error: ‘WXWidget’ does not name a type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|171|error: ISO C++ forbids declaration of ‘GtkWidget’ with no type|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|171|error: ‘GtkWidget’ declared as a ‘virtual’ field|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|171|error: expected ‘;’ before ‘*’ token|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|172|error: ‘GtkWidget’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|186|error: ‘GtkWidget’ has not been declared|
/var/wxWidgets-2.8.12/include/wx/gtk/window.h|187|error: ‘GtkWidget’ has not been declared|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

I understand that the answer is right in front of me in one of those threads, but due to my inexperience I can't seem to apply the solutions to my situation. I gave up after 1 hour of trying random things.

like image 932
natli Avatar asked Nov 22 '11 21:11

natli


1 Answers

I have no experience with codeblocks, but wx-config gives you the flags and libraries you need to work with wxWidgets.

wx-config --cxxflags

will give you the compiler flags, like include directories and #defines. On my system this gives me

-I/usr/local/lib/wx/include/gtk2-unicode-2.9 -I/usr/local/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread

On the other side

wx-config --libs

will give you the library path and libraries for linking. Which on my system results in

-L/usr/local/lib -pthread   -lwx_gtk2u_xrc-2.9 -lwx_gtk2u_html-2.9 -lwx_gtk2u_qa-2.9 -lwx_gtk2u_adv-2.9 -lwx_gtk2u_core-2.9 -lwx_baseu_xml-2.9 -lwx_baseu_net-2.9 -lwx_baseu-2.9 

So you could probably just use the outputs of those commands and enter them to the respective options in Code::Blocks.

An alternative could be to use CMake to generate a simple wxWidgets application, let it build the Code::Blocks project and then hijack that for your own application.

like image 113
LiMuBei Avatar answered Sep 30 '22 08:09

LiMuBei