Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 527
Casey Kuball Avatar asked Feb 23 '23 00:02

Casey Kuball


2 Answers

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).

like image 194
Neil Brown Avatar answered Apr 29 '23 14:04

Neil Brown


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.

like image 32
pvairam Avatar answered Apr 29 '23 12:04

pvairam