Casey Kuball
Casey Kuball

Reputation: 7965

Building Qt for Visual Studio 2010 - cannot open file 'qtmaind.lib'

I'm trying to start a C++ Qt application and have it run and compile in Visual Studio 2010.

Doing some googling, I found that there was a Visual Studio Qt Add-in, and so I installed this. I already had a MinGW Qt binary installed, and when this did not work, I found that you have to compile the source for Visual Studio 2010 (the VS 2008 binary will cause deployment issues).

Using this as a guide: How to build Qt for Visual Studio 2010, I compiled the open source version, and added it to the PATH, along with a QTDIR env variable. Hoping that I got it finally working, I created a "Qt Application" using the New Project Wizard in Visual Studio 2010. Once I finished, I tried to build the program, only to see the following error:

1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'

I looked in the C:\QT\lib folder, and found that I only have a qtmaind.prl, but no clue as to why there is no qtmaind.lib.

I am able to echo the QMAKESPEC environmental variable to get a 'win32-msvc2010' output.

I've tried several different combinations of flags for the configure step, including the one in the link, and even tried manually setting the -platform flag.

If anyone can offer any help, it would be greatly appreciated! :D

Upvotes: 4

Views: 13586

Answers (4)

maziar navahan
maziar navahan

Reputation: 73

in QT 5.3 with vs 2013

in properties -> linker -> input

remove ANY path for qt libraries such qtmaind.lib

this is known BUG

Upvotes: -1

pvairam
pvairam

Reputation: 61

I encountered this issue when running a project whose settings were hardcoded for a particular machine setup.

I could see that the vcxproj file had something like: C:\Qt\4.8.1\libqtmaind.lib

I could not find this lib file in my machine. I replaced the line by: C:\Qt\4.7.3\lib\Qtmaind.lib

It looks like the names of library files are different across Qt versions.Or, maybe the library files were renamed.

Also, the 'd' denoted debug. If you cannot find any lib file post-fixed by 'd', it is likely that you did not 'make' a debug version of Qt. You can cross check this by opening the .Sln file created by configure. Mine was named Projects.sln. You can open this in notepad and see if win32-debug configurations are present.

Upvotes: 1

Neil Brown
Neil Brown

Reputation: 3558

Just ran across this same problem. I changed the "-release" flag from the linked guide to "-debug-and-release", and then it built the qtmaind.lib library (presumably, that "d" suffix stands for debug).

Upvotes: 8

Tim Meyer
Tim Meyer

Reputation: 12600

This might be a QMAKESPEC issue. Try setting your QMAKESPEC environment variable to

win32-msvc2010

and rebuild Qt like that. This should give you .lib files in your Qt folder

Upvotes: 0

Related Questions