当前位置: 技术问答>linux和unix
windows下的起始函数是winmain,但是qt的主函数是main,如何在windows下启动?
来源: 互联网 发布时间:2015-06-21
本文导语: 我在windows下如下代码: #include #include int main( int argc, char **argv ) { QApplication a( argc, argv ); QPushButton hello( "Hello world!", 0 ); hello.resize( 100, 30 ); a.setMainWidget( &hello ); hello.sho...
我在windows下如下代码:
#include
#include
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:Studyt2>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~1BrillyLOCALS~1
Tempnma03640.
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.
#include
#include
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:Studyt2>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~1BrillyLOCALS~1
Tempnma03640.
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.
|
是不是要把/SUBSYSTEM:windows
改成/SUBSYSTEM:console
改成/SUBSYSTEM:console