K
Kevin
Hi guys,
I am a beginner for QT, and I installed the free qt 2.3 under windows
(XP), as well as the MS's free VC expression edition (for their
compilers, linkers, etc), and the SDK tool.
My first qt program is simple: the first demo which comes with the qt
2.3 installation. The only one code file is: main.cpp, and it is:
#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();
}
Then I try to compile and link it, using:
cl -c -nologo -I%QTDIR%/include -Fmain.obj main.cpp
link /NOLOGO /SUBSYSTEM:windows /OUT:main main.obj %QTDIR%/lib/qt-
mt230nc.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib
winmm.lib wsock32.lib
Now, here comes the error message:
== for the cl, it says ================
main.cpp
c:\qt\2.3\include\qcstring.h(93) : warning C4996: 'strcpy' was
declared deprecated
c:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE
\string.h(73) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider
using strcpy_s instead. To disable deprecation, use
_CRT_SECURE_NO_DEPRECATE. See online help for details.'
c:\qt\2.3\include\qcstring.h(96) : warning C4996: 'strcpy' was
declared deprecated
c:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE
\string.h(73) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider
using strcpy_s instead. To disable deprecation, use
_CRT_SECURE_NO_DEPRECATE. See online help for details.'
But it looks ok since these are just warnings, right?
====== then I try to link it, with these errors =======
main.obj : error LNK2019: unresolved external symbol "private: static
struct QStringData * QString::shared_null" (?
shared_null@QString@@0PAUQStringData@@A) referenced in function
"public: __thiscall QString::~QString(void)" (??1QString@@QAE@XZ)
LIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol
_WinMain@16 referenced in function ___tmainCRTStartup
main : fatal error LNK1120: 2 unresolved externals
==================
Any ideas of the link error?
Thanks a lot!
I am a beginner for QT, and I installed the free qt 2.3 under windows
(XP), as well as the MS's free VC expression edition (for their
compilers, linkers, etc), and the SDK tool.
My first qt program is simple: the first demo which comes with the qt
2.3 installation. The only one code file is: main.cpp, and it is:
#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();
}
Then I try to compile and link it, using:
cl -c -nologo -I%QTDIR%/include -Fmain.obj main.cpp
link /NOLOGO /SUBSYSTEM:windows /OUT:main main.obj %QTDIR%/lib/qt-
mt230nc.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib imm32.lib
winmm.lib wsock32.lib
Now, here comes the error message:
== for the cl, it says ================
main.cpp
c:\qt\2.3\include\qcstring.h(93) : warning C4996: 'strcpy' was
declared deprecated
c:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE
\string.h(73) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider
using strcpy_s instead. To disable deprecation, use
_CRT_SECURE_NO_DEPRECATE. See online help for details.'
c:\qt\2.3\include\qcstring.h(96) : warning C4996: 'strcpy' was
declared deprecated
c:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE
\string.h(73) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider
using strcpy_s instead. To disable deprecation, use
_CRT_SECURE_NO_DEPRECATE. See online help for details.'
But it looks ok since these are just warnings, right?
====== then I try to link it, with these errors =======
main.obj : error LNK2019: unresolved external symbol "private: static
struct QStringData * QString::shared_null" (?
shared_null@QString@@0PAUQStringData@@A) referenced in function
"public: __thiscall QString::~QString(void)" (??1QString@@QAE@XZ)
LIBCMT.lib(wincrt0.obj) : error LNK2019: unresolved external symbol
_WinMain@16 referenced in function ___tmainCRTStartup
main : fatal error LNK1120: 2 unresolved externals
==================
Any ideas of the link error?
Thanks a lot!