[Product exchange] 请帮我看看 include 正常,但定义变量或指针都报错,能是什么原因? Resolved
Tofloor
poster avatar
MFC转班生
deepin
2025-11-17 15:50
Author

刚刚从windows想转过来学学,但这个IDE的问题卡了我两天,也没找到原因..

在网上找也没找到解决办法. 可能只是个小问题,

请各位前辈大神帮我看看,指点一下,能是什么原因? 非常感谢!

image.png

image.png

image.png

image.png

image.png

Reply Favorite View the author
All Replies
deepin
2025-11-17 16:06
#1
It has been deleted!
deepin
2025-11-17 16:16
#2

你的QtWidgets,要在CMake中配置。deepin IDE首次创建的Qt CMake项目,其CMakeLists.txt文件中只引导了Qt Core核心类库。

你正确的配置,应该是在CMakeLists.txt文件中增加Qt Widgets,如下图:

image.png

cmake文件中添加完Widgets配置信息后,你接着再到main.cpp文件中进行widget相关的include,如下代码块

//main.cpp
#include 
#include 
Reply View the author
wlly-lzh
deepin
2025-11-17 18:38
#3

链接错误,应该是你没有链接widgets。

在target_link_libraries.那里加上就好了。

Reply View the author
MFC转班生
deepin
2025-11-18 08:27
#4

谢谢 @凡 @wlly-lzh 两位,果然是这里的问题.

👍 👍👍👍

Reply View the author
MFC转班生
deepin
2025-11-18 08:33
#5

问题解决,结贴💯

image.png

Reply View the author
deepin
2025-11-18 12:33
#6
MFC转班生

问题解决,结贴💯

image.png

不客气,😄希望你也能参与deepin IDE的改进。

Reply View the author