gpt4 book ai didi

c++ - Code::Blocks WxWidget 错误 - 没有目标!你应该使用 wx-config 程序作为编译标志?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:48:03 27 4
gpt4 key购买 nike

我无法获取 Code::Blocks 附带的默认 WxWidget 模板进行编译。我收到的错误是 error "No Target! You should use wx-config program for compilation flags!(以及其他)

Google 引导我找到了一些链接,但我似乎无法理解

我发现了一个类似的线程; http://forums.codeblocks.org/index.php?topic=10122.0

“问题很可能是您将 wxwisgets 安装在非标准目录树中。”

wx-config --list

报告:

wxconf

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

报告:

wxconfpreopt

这是正确的吗?我说不出来。

另一个类似的线程; http://www.justlinux.com/forum/archive/index.php/t-105554.html

该主题中的人最终添加了 g++ 'wx-config --cflags' -o wxTest wxTest.cpp 作为编译/链接标志,但我尝试将其添加到“链接器设置 -> Code::Blocks 中的其他链接器选项”,它似乎没有做任何事情。

链接器:

linkopts

包括:

inclds

我发现整个链接器业务非常困惑,我不知道我哪里出错了。

完整错误列表:

/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 ===|

我知道其中一个主题的答案就在我面前,但由于我缺乏经验,我似乎无法将解决方案应用到我的情况中。在随机尝试 1 小时后我放弃了。

最佳答案

我没有使用代码块的经验,但是 wx-config 为您提供了使用 wxWidgets 所需的标志和库。

wx-config --cxxflags

将为您提供编译器标志,例如包含目录和#defines。在我的系统上,这给了我

-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

另一边

wx-config --libs

将为您提供库路径和用于链接的库。这在我的系统上导致

-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 

因此您可能只使用这些命令的输出并将它们输入到 Code::Blocks 中的相应选项。

另一种方法是使用 CMake 生成一个简单的 wxWidgets 应用程序,让它构建 Code::Blocks 项目,然后为您自己的应用程序劫持它。

关于c++ - Code::Blocks WxWidget 错误 - 没有目标!你应该使用 wx-config 程序作为编译标志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8234375/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com