Code :: Blocks WxWidget Error - No Goal! Should you use wx-config for compilation flags?

I cannot get the default WxWidget template that comes with Code :: Blocks for compilation. The error I get is error "No Target! You should use wx-config program for compilation flags! (Among others)

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

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

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

wx-config --list

Reports:

wxconf

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

Reports:

wxconfpreopt

It is right? I can not tell.

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

The person in this section ended up adding g++ 'wx-config --cflags' -o wxTest wxTest.cpp as a compilation / binding flag, but I tried to add it to “Linker Settings → Other Linker Settings” in Code :: Blocks and doesn't seem to be doing anything.

Linker:

linkopts

Includes:

inclds

I believe that this whole business linker is extremely confusing, and I cannot figure out where I am going wrong.

Full list of errors:

 /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 these flows, but because of my inexperience, I can not apply solutions to my situation. I quit after 1 hour trying random things.

+4
source share
1 answer

I have no experience with code blocks, but wx-config provides you with the flags and libraries needed to work with wxWidgets.

 wx-config --cxxflags 

will give you compiler flags, for example, include directories and #defines. On my system, it 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 hand

 wx-config --libs 

will provide you a library path and library to link to. Which of my system leads to

 -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 

Thus, you could simply use the outputs of these commands and enter them in the appropriate parameters in Code :: Blocks.

An alternative would be to use CMake to create a simple wxWidgets application, let it create a Code :: Blocks project and then capture it for your own application.

+4
source

Source: https://habr.com/ru/post/1382598/


All Articles