PDA

View Full Version : VC++ 2008 compile error



cutie.monkey
2nd December 2009, 02:28
hi folks, im new to VC++ programming with QT. I'm using Visual Studio 2008, Opensource Qt 4.5.3 and Qt4 Visual Studio Add In 1.1.1. I've created a new Qt4 application project and try to compile it, but during compilation i got this error:


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

could anyone help me to fix this error? thnks:confused:

schnitzel
2nd December 2009, 03:42
technically, that is not an error in the compilation stage, but rather in the linking stage.
Do you know where this 'qtmain.lib' exists?
VS has a problem opening or locating the said library.
Did you perhaps forget to tell VS where it can find this library?

There might be a good reason why you are using VS, but if you are just starting with C++ and Qt, you might be better off using Qt Creator. That way it is easier to try out Qt examples.

Something like this might be a good read:
http://www.cs.duke.edu/~ola/book/compiling.html

Once you master that, I would recommend diving into Qt's excellent online documentation:
http://doc.qt.nokia.com/4.6/how-to-learn-qt.html

There is a reference to an online book on the above page if you prefer more guided approach.

good luck

cutie.monkey
2nd December 2009, 04:54
Do you know where this 'qtmain.lib' exists?


no, i have searched the Qt install directory but i can't find it. All i found are the .a's files under the lib folder.



There might be a good reason why you are using VS,


yes, you're right. i'm currently trying to convert a program to qt, it is created using visual c++.



but if you are just starting with C++ and Qt, you might be better off using Qt Creator. That way it is easier to try out Qt examples.


actually, i'm no longer a qt beginner, i've already created programs using Qt Creator and QDevelop. Now, i'm trying to use and learn Visual C++ with Qt.

squidge
2nd December 2009, 08:06
Did you recompile Qt to support Visual Studio? Otherwise no .lib files exist, only .a files. Once you rebuild Qt using Visual studios compiler, there will be .lib files.

cutie.monkey
2nd December 2009, 08:52
Did you recompile Qt to support Visual Studio?


not yet, how can i recompile it to support VS?

squidge
2nd December 2009, 09:03
You need to run 'configure' from a dos prompt.

Eg.

configure -platform win32-msvc2008

and then build the libraries using nmake

This can easily take 4 hours or more, so be patient.

cutie.monkey
2nd December 2009, 09:06
thnks, so i have to configure Qt first...

HalphaZ
6th December 2009, 10:53
"and Qt4 Visual Studio Add In 1.1.1" <-- this should avoid QT compilation, doesn't it?

charles1812
25th April 2011, 08:44
Hey, someone discuss a relative topic:How to automatically stop Visual C++ 2008 build at first compile error? (http://www.longhowl.com/howls/138) , maybe helpful