您好,使用“yum install wxGTK-devel”安装了 wxWidgets(我使用的是 fedora 20)。 我正在尝试编译以下示例文件:
测试.cpp:
#include <wx/wx.h>
int main(void)
{
return 0;
}
使用这一行:
g++ -I/usr/include/wx-2.8 pru.cpp
但我知道 wx/setup.h 不存在。我四处寻找,但没有找到。
问题是在wx/platform.h中有如下一句:
#include "wx/setup.h"
我不知道这应该如何工作或如何让它工作。 如果您知道如何解决这个问题或至少有提示,我将不胜感激。
最佳答案
从 wxWidgets documentation 开始关注:
Linking and Compiling
Normally when you include wxWidgets you say "wx/wx.h" however wxwidgets is in the subdirectory of wx-2.8/wx so what we are going to do is create a link to wx-2.8/wx.
sudo ln -sv wx-2.8/wx wx
That's all, now your files should compile correctly.
When you compile your files to include the wxWidgets libraries, add this to the end of your gcc command:
`wx-config --cxxflags` `wx-config --libs`
例如:
g++ your_code.cpp `wx-config --cxxflags` `wx-config --libs`
关于c++ - wxWidgets - 缺少 wx/setup.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30462649/