gpt4 book ai didi

qt - 无法让 QT "hello world"工作!

转载 作者:行者123 更新时间:2023-12-04 13:29:40 33 4
gpt4 key购买 nike

#include <QtCore/QCoreApplication>
#include <QtGui/QLabel>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QLabel label("Hello world");
label.show();
return a.exec();
}

我正在使用 QTCreator,我在 Windows 上安装了 QT 4.7。
现在每次编译时都会出现此错误:
:: error: collect2: ld returned 1 exit status
With mingw32 giving me the following
tmp/obj/debug_shared/main.o: In function `main':
E:\Qt\2010.04\qt\QTHello-build-desktop/../QTHello/main.cpp:6: undefined reference to `_imp___ZN6QLabelC1ERK7QStringP7QWidget6QFlagsIN2Qt10WindowTypeEE'
E:\Qt\2010.04\qt\QTHello-build-desktop/../QTHello/main.cpp:8: undefined reference to `_imp___ZN6QLabelD1Ev'
E:\Qt\2010.04\qt\QTHello-build-desktop/../QTHello/main.cpp:8: undefined reference to `_imp___ZN6QLabelD1Ev'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\QTHello.exe] Error 1
mingw32-make: *** [debug-all] Error 2
The process "E:/Qt/2010.04/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project QTHello (target: Desktop)
When executing build step 'Make'

有什么问题??

最佳答案

创建一个 Qt GUI 项目 然后奥尔尼写下你写的东西。

关于qt - 无法让 QT "hello world"工作!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3587689/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com