0

我厌倦了在互联网上搜索。我创建了一个 kclient-serwer 程序,该程序仅通过特定端口上的 IP 关闭计算机。我用 C 语言制作了整个东西,一切正常,我正在使用带有 -Wall 选项的 gcc 编译我的项目,我已经清楚了结果。但我必须创建 GUI,所以我决定使用 QT Creator IDE,我将代码从 C 转移到 C++ 并制作了 GUI。程序有效,但我必须使用带有 -Wall 选项的 g++ 编译它。问题是,我无法编译任何东西。

g++ my_project.cpp -o mypro -Wall

ERROR: fatal error: QMainWindow: directory don't exist (in my native language)
compilation terminated
(same with other source files)

有任何想法吗?这很容易,但相信我,我想编译这个然后去睡觉。干杯

4

2 回答 2

1

Why don't you use qmake? First, you can edit your *.pro file and add any compiler flags you wish (see Mitch's comment). Then, if you execute qmake and then make, it will show you a sequence of compilation commands with proper flags, linker and include paths and so on. After that you can just reproduce that commands manually if your teacher wants so.

于 2013-01-15T01:44:14.767 回答
0

该错误表明编译器正试图像打开QMainWindow一个目录一样打开它(如果翻译正确),或者至少无法找到 Qt 的包含文件所在的位置。您可能需要提供一些 -I 选项来提示编译器 Qt 标头的位置,并确保#include代码中的指令正确。

于 2013-01-14T23:02:07.853 回答