Thursday, November 20th 2008, 1:17pm UTC

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Style

Beginner

1

Monday, March 24th 2008, 7:20am

Link error in visual studio 2008

I'm using Visual Studio 2008 and when i try to compile basic Hello World porgram comes many link errors:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
------ Build started: Project: qthar, Configuration: Debug Win32 ------
Linking...
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QApplication::~QApplication(void)" (__imp_??1QApplication@@UAE@XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QPushButton::~QPushButton(void)" (__imp_??1QPushButton@@UAE@XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static int __cdecl QApplication::exec(void)" (__imp_?exec@QApplication@@SAHXZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::show(void)" (__imp_?show@QWidget@@QAEXXZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall QWidget::resize(int,int)" (__imp_?resize@QWidget@@QAEXHH@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::~QString(void)" (__imp_??1QString@@QAE@XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QPushButton::QPushButton(class QString const &,class QWidget *)" (__imp_??0QPushButton@@QAE@ABVQString@@PAVQWidget@@@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QString::QString(char const *)" (__imp_??0QString@@QAE@PBD@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QApplication::QApplication(int &,char * *,int)" (__imp_??0QApplication@@QAE@AAHPAPADH@Z) referenced in function _main
9 unresolved externals
qthar - 10 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

What might be wrong ? I have linked qtmain.lib and qtmaind.lib...

This post has been edited 2 times, last edit by "Style" (Mar 24th 2008, 10:57am)

  • Go to the top of the page

stinos

Intermediate

2

Monday, March 24th 2008, 11:05am

RE: Link error in visual studio 2008

1) you cannot link both qtmain and qtmaind: first one is release version, second one is debug -> linker will only use the first one anyway
2) you also need QtCore.lib, QtGui.lib etc
madinsjamania
  • Go to the top of the page

Style

Beginner

3

Monday, March 24th 2008, 11:16am

RE: Link error in visual studio 2008

Quoted

Originally posted by stinos
1) you cannot link both qtmain and qtmaind: first one is release version, second one is debug -> linker will only use the first one anyway
2) you also need QtCore.lib, QtGui.lib etc


hmh... i just tested link both of them, but i dont have any QtCore, QtGui libs :S in lib folder is only some .a and .prl files. I've run config but while running nmake come some damn error (link error) and operation aborts with error code 0x2

Edit: nmake error comes on file qdom.cpp, qxmlutils_p.cpp qxml.cpp

Source code

1
qdom.cppqxmlutils_p.cppqxml.cppGenerating Code... link /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSOLE /MANIFESTFILE:"tmp\obj\release_shared\rcc.intermediate.manifest" /OUT:..\..\..\bin\rcc.exe @C:\Users\Ilari\AppData\Local\Temp\nmB33B.tmpqbytearray.obj : error LNK2019: unresolved external symbol _compress2 referenced in function "class QByteArray __cdecl qCompress(unsigned char const *,int,int)" (?qCompress@@YA?AVQByteArray@@PBEHH@Z)qbytearray.obj : error LNK2019: unresolved external symbol _uncompress referenced in function "class QByteArray __cdecl qUncompress(unsigned char const *,int)"(?qUncompress@@YA?AVQByteArray@@PBEH@Z)..\..\..\bin\rcc.exe : fatal error LNK1120: 2 unresolved externalsNMAKE : fatal error U1077: '"E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.EXE"' : return code '0x460'Stop.NMAKE : fatal error U1077: '"E:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2'Stop.NMAKE : fatal error U1077: 'cd' : return code '0x2'Stop.

This post has been edited 3 times, last edit by "Style" (Mar 24th 2008, 11:46am)

  • Go to the top of the page

stinos

Intermediate

4

Wednesday, March 26th 2008, 9:15am

strange...
did you use 'win32-msvc2005' as QMAKESPEC ?
madinsjamania
  • Go to the top of the page

Style

Beginner

5

Wednesday, March 26th 2008, 4:05pm

Vista might be the problem

I think tht vista might be the problem because i did exactly same on my XP and works perfectly :S

I also use Visual Studio Standard at vista not express
  • Go to the top of the page

TimHN

Beginner

6

Friday, May 16th 2008, 12:40pm

I experience the exact same problem. Using the Open source version of Qt on XP pro with Visual Studio 2005.

Did you find out what the problem was please?
  • Go to the top of the page

stinos

Intermediate

7

Friday, May 16th 2008, 1:56pm

well looking at the source (qcstring.cpp), compress and uncompress are from the zlib library. either #define QT_NO_COMPRESS manually (or pass -no-zlib to configure), or fix the .pro file to link with zlib
madinsjamania
  • Go to the top of the page

Rate this thread