简体   繁体   English

如何在 Ubuntu 上正确设置 WXWidgets? 我的编辑告诉我头文件不正确

[英]How do I correctly set up WXWidgets on Ubuntu? My editor tells me the header files are incorrect

I wanted to try out the WXWidgets Hello World example ( https://docs.wxwidgets.org/latest/overview_helloworld.html ) so I followed the recommended practice on the Downloads page and installed the WXGTK package for my distribution, Ubuntu, which appears to be libwxgtk3.0-gtk3-dev .我想试用 WXWidgets Hello World 示例 ( https://docs.wxwidgets.org/latest/overview_helloworld.html ),所以我遵循了下载页面上的推荐做法,并为我的发行版 Ubuntu 安装了 WXGTK 包,它出现成为libwxgtk3.0-gtk3-dev After doing this, and copying the example code, g++ (installed from build-essentials ) throws an error when I attempt to compile the program:这样做并复制示例代码后,当我尝试编译程序时, g++ (从build-essentials安装)抛出错误:

wxtest.cpp:4:10: fatal error: wx/wxprec.h: No such file or directory
    4 | #include <wx/wxprec.h>
      |          ^~~~~~~~~~~~~
compilation terminated.

My editor (VSCode) also shows me an error: cannot open source file "wx/wxprec.h" .我的编辑器 (VSCode) 也显示了一个错误: cannot open source file "wx/wxprec.h"

This appears to be related to the fact that the WXWidgets header files are installed to the folder wx-3.0/wx instead of wx , but after changing #include <wx/wxprec.h> to #include <wx-3.0/wx/wxprec.h> I still get an error:这似乎与 WXWidgets 头文件安装到文件夹wx-3.0/wx而不是wx的事实有关,但是在将#include <wx/wxprec.h>更改为#include <wx-3.0/wx/wxprec.h>我仍然收到错误消息:

In file included from wxtest.cpp:4:
/usr/include/wx-3.0/wx/wxprec.h:12:10: fatal error: wx/defs.h: No such file or directory
   12 | #include "wx/defs.h"
      |          ^~~~~~~~~~~
compilation terminated.

What am I doing wrong?我究竟做错了什么? How can these files be put in the right place?如何将这些文件放在正确的位置?

See the building your project section of the docs.请参阅文档的构建项目部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM