windows下的起始函数是winmain,但是qt的主函数是main,如何在windows下启动?

辉歌 辉歌 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我在windows下如下代码:
#include <qapplication.h>
#include <qpushbutton.h>


int main( int argc, char **argv )
{
QApplication a( argc, argv );

QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );

a.setMainWidget( &hello );
hello.show();
return a.exec();
}

qmake后namke提示:
F:\Study\t2>nmake

Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

link /NOLOGO /SUBSYSTEM:windows /OUT:t2.exe @C:\DOCUME~1\Brilly\LOCALS~1
\Temp\nma03640.
LINK : warning LNK4001: no object files specified; libraries used
LINK : warning LNK4068: /MACHINE not specified; defaulting to IX86
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
t2.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
...全文
评论 2
收藏 已收藏
分享
返回顶部
辉歌
Linux/Unix社区 23,224 成员 74,535 内容