PDA

View Full Version : Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'



Ashish
6th October 2006, 16:56
Hi,

I recently installed Qt open source version 4.1.4 on my windows xp workstation along with the visual studio compiler patch as per the instructions on 'http://qtnode.net/wiki/Qt4_with_Visual_Studio '. I already have visual studio 2005 pro installed on my workstation. I tried the hello world example from the same webpage, but it came back with the following error:

fatal error LNK1181: cannot open input file 'qtmain.lib'

Can anyone please help me figure out what's wrong here? I am a complete novice in Qt and would appreciate all help.

Thanks,
Ashish

jpn
6th October 2006, 17:11
Are you testing your installation by compiling the HelloWorld example from the command line as told? What are the exact commands you execute?

jpn
6th October 2006, 17:12
Please, don't double post.

Ashish
6th October 2006, 17:34
Thanks for replying jpn. Yes I am testing my installation with the helloworld example. I don't know if there is any other way of compiling the code and was therefore following the command line compiling as per the qtnode webpage using qmake.

I copied that example in a directory ,went into that directory from the command line and executed the following commands:

1) qmake -project -t vcapp -o helloworld.pro ( to create a helloworld.pro file)
2) qmake ( to create a .vcproj file)

Then I double clicked on .vcproj file to open it in visual studio and build it there when it gave me that error.

Here is what my helloworld.pro file looks like after I execute the 1st command as above
-------------------
TEMPLATE = vcapp
TARGET +=
DEPENDPATH +=
INCLUDEPATH +=

# Input
SOURCES += helloworld.cpp
------------------

Before running the test example I have added 2 environment variables (in my system variables list) as per the instructions on the qtnode webpage from where I installed the whole thing and they are:

a) variable name: QMAKESPEC, value=win32-msvc2005
b) variable name: QTDIR, value=C:\Qt

Do I need to add anything else? and are there any more config steps to be completed after this?

I don't know what is going wrong here and would appreciate all help.

Thanks,
Ashish

jpn
6th October 2006, 17:48
Just curious, what does this output?


qmake -v


Try compiling HelloWorld from the command line (open up the VS command prompt for example from start menu, under Visual Studio Tools).


cd HelloWorld
qmake -project
qmake
nmake

Ashish
6th October 2006, 18:29
the out put of qmake -v is:
----
D:\ashishdocs\programming\qttutorials\helloworld>qmake -v
QMake version: 2.00a
Using Qt version 4.1.4 in C:\Qt\4.1.4\qt-win-opensource-src-4.1.4\lib
----

I tried compiling helloworld from the command line as per the commands you suggested. here is what I get:
---
D:\ashishdocs\programming\qttutorials\helloworld>qmake -project

D:\ashishdocs\programming\qttutorials\helloworld>qmake

D:\ashishdocs\programming\qttutorials\helloworld>nmake

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

"C:\Program Files (x86)\Microsoft Visual Studio 8\VC\BIN\nmake.exe" -f M
akefile.Release

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.

cl -c -nologo -Zm200 -GS -O1 -MD -DNDEBUG -GR -EHsc -W3 -DUNICODE -DQT_L
ARGEFILE_SUPPORT -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
-DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"C:/Qt/4
.1.4/qt-win-opensource-src-4.1.4/include/QtCore" -I"C:/Qt/4.1.4/qt-win-opensourc
e-src-4.1.4/include/QtGui" -I"C:/Qt/4.1.4/qt-win-opensource-src-4.1.4/include" -
I"." -I"C:/Qt/4.1.4/qt-win-opensource-src-4.1.4/include/ActiveQt" -I"release" -I
"." -I"c:\Qt\4.1.4\qt-win-opensource-src-4.1.4\mkspecs\win32-msvc2005" -Foreleas
e\ @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\nm17.tmp
helloworld.cpp
link /LIBPATH:"c:\Qt\4.1.4\qt-win-opensource-src-4.1.4\lib" /NOLOGO /SUB
SYSTEM:WINDOWS /incremental:no /OUT:"release\helloworld.exe" @C:\DOCUME~1\ADMINI
~1\LOCALS~1\Temp\nm18.tmp
MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts wi
th use of other libs; use /NODEFAULTLIB:library

D:\ashishdocs\programming\qttutorials\helloworld>
--------
This works-there is a helloworld.exe in release folder. But then how do I open it in visual studio IDE for editing/debug etc. I need to use Qt with another 3D visualization API known as VTK.

jpn
6th October 2006, 18:31
the out put of qmake -v is:
----
D:\ashishdocs\programming\qttutorials\helloworld>qmake -v
QMake version: 2.00a
Using Qt version 4.1.4 in C:\Qt\4.1.4\qt-win-opensource-src-4.1.4\lib

So the QTDIR environment variable should be:
C:\Qt\4.1.4\qt-win-opensource-src-4.1.4

Ashish
6th October 2006, 18:56
Even after changing the environment variable, it still gives me the same error.

However the commands that you suggested do give an executable that works fine. The commands are-
cd HelloWorld
qmake -project
qmake
nmake

But how can I open it in Visual Studio IDE?

jpn
6th October 2006, 21:26
So it clearly fails to build up a proper VS project file. Anyhow, I'm unfortunately out of ideas. I've never even used that patch anyway.. ;) But make sure you've followed the instructions properly. You may as well stop by at #qt IRC channel on freenode to ask people who wrote that article.

Ashish
11th October 2006, 00:49
I am finally able to run Qt with VS2005. It is working fine now.Thanks for all help guys.

Ashish
11th October 2006, 17:05
Hi ashish, read ur post regarding the qt and VS 2005 prob

I would like to know if u are using open source of Qt ...
and if yes, how do u integrate it with Visual Studio 2005 ?
Have u also tried integrating Qt qith Visual Studio 6 ??

Also I think u have used Qt 4.1.4 ,,, have u tried Qt 4.2.0 ??
and if yes, open or commercial edition ??

Hi aamer4yu,

Yes I am using open source Qt, version 4.1.4. To integrate it with visual studio, I followed the instructions here:http://qtnode.net/wiki/Qt4_with_Visual_Studio

No, I have not tried integrating Qt with VS6.0 and also I haven't tried Qt 4.2.0 yet.
If you are also trying to integrate Qt with VS, try the instructions in the link above step by step, it should work. Let me know if you run into any probs.

-Ashish