Results 1 to 11 of 11

Thread: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

  1. #1
    Join Date
    Oct 2006
    Location
    USA
    Posts
    23
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    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

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    Are you testing your installation by compiling the HelloWorld example from the command line as told? What are the exact commands you execute?
    J-P Nurmi

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    Please, don't double post.
    J-P Nurmi

  4. #4
    Join Date
    Oct 2006
    Location
    USA
    Posts
    23
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    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

  5. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    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
    J-P Nurmi

  6. #6
    Join Date
    Oct 2006
    Location
    USA
    Posts
    23
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    the out put of qmake -v is:
    ----
    D:\ashishdocs\programming\qttutorials\helloworld>q make -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>q make -project

    D:\ashishdocs\programming\qttutorials\helloworld>q make

    D:\ashishdocs\programming\qttutorials\helloworld>n make

    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.

  7. #7
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    Quote Originally Posted by Ashish View Post
    the out put of qmake -v is:
    ----
    D:\ashishdocs\programming\qttutorials\helloworld>q make -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
    J-P Nurmi

  8. #8
    Join Date
    Oct 2006
    Location
    USA
    Posts
    23
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    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?

  9. #9
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    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.
    J-P Nurmi

  10. #10
    Join Date
    Oct 2006
    Location
    USA
    Posts
    23
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    I am finally able to run Qt with VS2005. It is working fine now.Thanks for all help guys.

  11. #11
    Join Date
    Oct 2006
    Location
    USA
    Posts
    23
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt 4.1.4 on VS2005 error- cannot open input file 'qtmain.lib'

    Quote Originally Posted by aamer4yu
    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

Similar Threads

  1. Installing Qt 4.1.4 (open source) on windows with vs2005
    By Randulf in forum Installation and Deployment
    Replies: 1
    Last Post: 19th August 2006, 12:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.