我正在尝试一些跨平台的 GUI 环境,并且正在使用 codelite 评估 wxWidgets,但一开始就卡住了。
我对此很陌生,如果这是一个愚蠢的问题,请说出来。
先决条件是,
- 使用 OSX 山狮
- 通过 home brew 安装 wxmac
- 下载 Codelite,创建了一个 wxWidgets Executable
我制作了一个 GUI 项目并尝试安装,但得到一堆缺少的标头错误。
make[1]: wx-config: Command not found
g++ -c "xxxx/helloworld/main.cpp" -g -O0 -Wall -o ./Debug/main.o -I. -I.
g++ -c "xxxx/helloworld/MainFrame.cpp" -g -O0 -Wall -o ./Debug/MainFrame.o -I. -I.
In file included from xxxx/helloworld/MainFrame.h:3,
from xxxx/helloworld/MainFrame.cpp:1:
xxxx/helloworld/wxcrafter.h:4:25: error: wx/settings.h: No such file or directory
xxxx/helloworld/wxcrafter.h:5:27: xxxx/helloworld/main.cpp:1:20: error: wx/app.h: No such file or directory
xxxx/helloworld/main.cpp:2:22: error: wx/event.h: No such file or directory
In file included from xxxx/helloworld/MainFrame.h:3,
from xxxx/helloworld/main.cpp:3:
xxxx/helloworld/wxcrafter.h:4:25: error: wx/settings.h: No such file or directory
xxxx/helloworld/wxcrafter.h:5:27: error: wx/xrc/xmlres.h: No such file or directory
xxxx/helloworld/wxcrafter.h:6:27: error: wx/xrc/xh_bmp.h: No such file or directory
xxxx/helloworld/wxcrafter.h:7:22: error: wx/frame.h: No such file or directory
xxxx/helloworld/wxcrafter.h:8:22: error: wx/sizer.h: No such file or directory
xxxx/helloworld/wxcrafter.h:9:22: error: wx/panel.h: No such file or directory
xxxx/helloworld/wxcrafter.h:10:21: error: wx/menu.h: No such file or directory
xxxx/helloworld/wxcrafter.h:11:24: error: wx/toolbar.h: No such file or directory
xxxx/helloworld/main.cpp:4:22: error: wx/image.h: No such file or directory
In file included from xxxx/helloworld/MainFrame.h:3,
from xxxx/helloworld/main.cpp:3:
xxxx/helloworld/wxcrafter.h:14: error: expected class-name before '{' token
xxxx/helloworld/wxcrafter.h:16: error: ISO C++ forbids declaration of 'wxPanel' with no type
xxxx/helloworld/wxcrafter.h:16: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:17: error: ISO C++ forbids declaration of 'wxMenuBar' with no type
xxxx/helloworld/wxcrafter.h:17: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:18: error: ISO C++ forbids declaration of 'wxMenu' with no type
xxxx/helloworld/wxcrafter.h:18: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:19: error: ISO C++ forbids declaration of 'wxMenuItem' with no type
xxxx/helloworld/wxcrafter.h:19: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:20: error: ISO C++ forbids declaration of 'wxMenu' with no type
xxxx/helloworld/wxcrafter.h:20: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:21: error: ISO C++ forbids declaration of 'wxMenuItem' with no type
xxxx/helloworld/wxcrafter.h:21: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:22: error: ISO C++ forbids declaration of 'wxToolBar' with no type
xxxx/helloworld/wxcrafter.h:22: error: expected ';' before '*' token
xxxx/helloworld/wxcrafter.h:25: error: 'wxCommandEvent' has not been declared
xxxx/helloworld/wxcrafter.h:26: error: 'wxCommandEvent' has not been declared
xxxx/helloworld/wxcrafter.h:29: error: expected `)' before '*' token
xxxx/helloworld/wxcrafter.h: In member function 'virtual void MainFrameBaseClass::OnExit(int&)':
xxxx/helloworld/wxcrafter.h:25: error: request for member 'Skip' in 'event', which is of non-class type 'int'
xxxx/helloworld/wxcrafter.h: In member function 'virtual void MainFrameBaseClass::OnAbout(int&)':
xxxx/helloworld/wxcrafter.h:26: error: request for member 'Skip' in 'event', which is of non-class type 'int'
我的猜测是指定包含所有这些的文件夹,但不确定在哪里可以找到它们。
老实说,我不确定这是否是正确的操作,也许我需要安装或设置一些东西,也许我不应该使用自制软件并通过源代码安装
添加
感谢VZ。我得到了它的工作,不得不改变一些构建设置,如下
- Settings>BuildSettings>gnu g++>Tools>PATH Environment Variables 设置为
/usr/local/bin:/usr/bin:/bin
- 将所有编译器、链接器、共享对象链接器设置设置为绝对路径,因此更改
克++
到
/usr/bin/g++
等等。
这肯定会随着机器的设置而改变,因此可能不应该完全按照它来做,但应该让你开始。
希望这可以帮助。