Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, March 2002
Simple Link problems in VC++, Qt3.0.2


Message 1 in thread

Hi;
I hope you are experts with these link stuff:

When I tried to build my project using Qt libraries, I got many of warnings 
similar to:

LINK : warning LNK4049: locally defined symbol ""class QApplication *  qApp" 
(?qApp@@3PAVQApplication@@A)" imported

and the following specific errors:

qtmtd.lib(qprinter_win.obj) : error LNK2001: unresolved external symbol 
_ClosePrinter@4
qtmtd.lib(qprinter_win.obj) : error LNK2001: unresolved external symbol 
_GetPrinterW@20
qtmtd.lib(qprinter_win.obj) : error LNK2001: unresolved external symbol 
_OpenPrinterW@12

What should I do?

Thanks


----Original Message Follows----
From: Bauer Thomas <Thomas.Bauer@fh-joanneum.at>
Reply-To: Thomas.Bauer@fh-joanneum.at
To: "'plc@rowley.co.uk'" <plc@rowley.co.uk>,    John Dean 
<john@theKompany.com>, ibarrett@grintek.com,    qt-interest@trolltech.com
Subject: AW: Alternatives to VC++ IDE?
Date: Wed, 13 Mar 2002 16:02:16 +0100

 > Why would you think that VC 6 is broken?  Can you provide an example?

have you ever tried this:

template<typename T1>
class A
{
	template<typename T2> //constructor
	A( T2 arg )
	{
		... some code ...
	}

	A( const A<T1>& rhs ) //copy constructor
	{
		... some code ...
	}
}

it doesn't even work this way:

template<typename T1>
class A
{
	template<typename T2> //constructor
	A( T2 arg )
	{
		... some code ...
	}

	template<T3>
	A( const A<T3>& rhs ) //copy constructor
	{
		... some code ...
	}
}

//////////////////////////////////////

When trying the first version MS VC++6 didn't recognize the copy constructor
although the standard says that when using constructor templates they must
never be taken for copy constructors by the compiler... and using the second
version a lot of funny things can happen starting with fatal errors during
compile time up to a case where after constructing an object the following
line of code wasn't compiled and when I tried to work around this bug
putting two semicolons after the code line which constructed the object the
app crashed with some memory error when exiting.

I circumvented the problem by not declaring a constructor template but a
separate init member function template because I needed the copy constructor
more desperately than initialization during construction due to the need to
use the class within stl containers.

Tom

-----Ursprüngliche Nachricht-----
Von: Paul Curtis [mailto:plc@rowley.co.uk]
Gesendet: Mittwoch, 13. März 2002 13:54
An: John Dean; ibarrett@grintek.com; qt-interest@trolltech.com
Betreff: RE: Alternatives to VC++ IDE?


John Dean wrote:

 > >The VC++ pros (can't really speak for .NET in general) is that:
 > >
 > >(a) it's rock solid.
 > >(b) it has a few bugs, but service packs generally fix them up.
 > >(c) lots of 3rd party plug-ins and support (even Trolltech provides a
 > >plug-in)
 > >(d) It works.  I start it in the morning and don't come out until I
 > >leave for home.  It runs all day.
 > >
 > >The cons:
 > >
 > >(a) The configuration/project system could be better.
 > >(b) It could have a more capable compiler, but it'll come.  No C++
 > >compiler is perfect.
 > >(c) Editor could be more powerful.
 > >(d) Help system could be better.
 >
 > You forgot to mention that the compiler and linker are both broken

The compiler and linker in VC 6 are not particularly broken in my
experience.  VC6 compiles Qt, our ECMAScript compiler, our smart card
loader, our project system, our help system, our crypto, our C compiler,
our linker & optimizer, and everything else we've thrown into this
single application.  The application is now quite large at about 8MB,
and has a huge amount of code.  There are no real problems to speak of.
We've stumbled across one optimizer bug when compiling our own RSA/DSS
code.

Why would you think that VC 6 is broken?  Can you provide an example?

I have no experience of VS.NET *release* (as I said), so cannot comment
on the perceived problems with VS.NET, but there are other on the
mailing list that seem to be researching the issue and making progress.

-- Paul.

--
 [ signature omitted ] 

Message 2 in thread

I don't have any specific answers, but I would do the following:

Look up the error codes in the MSDN library and try to understand them.
Look up the ClosePrinter etc. in the MSDN library and find out which .lib
file they belong to. Make sure that you are linking against that library,
and that you have that library on your machine somewhere that the linker can
find it.
Hope this is of some help, sorry if it isn't.
--
 [ signature omitted ] 

Message 3 in thread

Khaled Z wrote:

> Hi;
> I hope you are experts with these link stuff:
> 
> When I tried to build my project using Qt libraries, I got many of 
> warnings similar to:
> 
> LINK : warning LNK4049: locally defined symbol ""class QApplication *  
> qApp" (?qApp@@3PAVQApplication@@A)" imported
> 
> and the following specific errors:
> 
> qtmtd.lib(qprinter_win.obj) : error LNK2001: unresolved external symbol 
> _ClosePrinter@4
> qtmtd.lib(qprinter_win.obj) : error LNK2001: unresolved external symbol 
> _GetPrinterW@20
> qtmtd.lib(qprinter_win.obj) : error LNK2001: unresolved external symbol 
> _OpenPrinterW@12
> 
> What should I do?


Hi,

linking against winspool.lib should do it.

hth, Karsten