473,320 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Link QT 2.3 under win32?

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!

Aug 16 '07 #1
3 3319
"Kevin" <ha*************@yahoo.com.sgwrote in message
news:11**********************@x40g2000prg.googlegr oups.com...
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!
strcpy has been depreciated by Microsoft, not by anyone else. Those
warnings can be ignored

As for the link error, that is becuase you made a windows applicaiton. You
should of made a console applicaiton.
Aug 16 '07 #2
On 2007-08-17 00:30, Kevin wrote:
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.
Sorry, can't help you with that. For help with with QT ask in a group
discussing Qt, look at their homepage for more info, also
www.qtforum.org/ is quite good.

Should you post you question there they'll probably ask you the same
ting I'm asking you, why Qt 2.3? It's 8 revisions old, of which two were
major. The latest version of Qt is 4.3, if you don't like that one at
least use Qt 3.

--
Erik Wikström
Aug 16 '07 #3
Jim Langston wrote:
"Kevin" <ha*************@yahoo.com.sgwrote in message...
[...]
>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.
[...]
>
As for the link error, that is becuase you made a windows applicaiton. You
should of made a console applicaiton.
He wanted to make a windows application. He is using QT. So changing it
into a console application wouldn't help.

The problem is, that VC++ uses another entry point instead main() for a
Windows application as default. You can change this entry point to using
the main() function by some linker options. The OP can ask on a QT, VC++ or
Windows programming newsgroup on how to do that.

--
Thomas
http://www.netmeister.org/news/learn2quote.html
Aug 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Christos TZOTZIOY Georgiou | last post by:
Last night I was compiling the latest python snapshot at my home Linux system (a K6-III @420 --the extra 20 Hz is overclocking :); then I tried building a shared version of the interpreter. I did...
4
by: John Hunter | last post by:
I am using distutils to build a python extension module on win32. I initialize the Extension class with a list of libraries with Extension("_gd", , include_dirs=incdirs, library_dirs=libdirs,...
2
by: Jacques | last post by:
Hello there I'm pretty new to C, so this is probably an elementary question.... I'm trying to write a simple c program that calls a function in a third party library. I would then like to link...
7
by: BekTek | last post by:
When I build boost libs, I realized that there is static link at runtime.. What does that mean? I thought static linking is done at compile time. Am I wrong?
3
by: Leon | last post by:
Is it possible? Say We have a list of suppliers link like A supplier B supplier when right click on a supplier, a context menu(that has "details","view products", etc) appears and click...
3
by: James | last post by:
Does anybody knows how a link a win32 dll to c#? I'm particularly interested in linking the Opengl32.dll,glu32.dll to c#. I have seen the CsGL and tao Project however i would like to know how to...
3
by: Leith Bade | last post by:
I have been trying to use the new Visual C++ Toolkit 2003 with the VC6 IDE I set up the executable, inlcude, and library directories to point to the new compilers I had to fix a few errors in the...
0
by: Eric Twietmeyer | last post by:
Hello, Am I mistaken in thinking that if I have a mc++ dll that I should be able to link against it (so long as it has exported symbols via declspec(dllexport)) in an unmanaged application? I...
2
by: Angus | last post by:
Hello I am using some classes from a third party and have included them in my projecxt and am compiling and linking with them. Everything compiles ok but I get these link errors: I added...
1
yabansu
by: yabansu | last post by:
Hi all, I implemented a basic client application. It communicates with server and works properly. Building processes succeed just by giving the following warning: LINK : D:\DOC\Visual Studio...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.