Simple application runs in release, but debug gives me a linkage error

  • I am getting started learning QT using the most recent and freshly installed version of QT creator on a 64 bit windows system. If I make a simple hello world application, it compiles and runs just fine in release mode, but if I try and run it in debug mode it gives me an LNK1104: cannot open file 'qtmaind.lib'. Any ideas on what I can do to figure this out?

  • @Dan-Bumbarger

    Hi and welcome to devnet forum

    Did you right click on the project in the project pane and rerun qmake?
    Do a rebuild after this.

  • Thanks for the response! I had already tried that, but went ahead and tried again to no avail.. I've also tried it on both console and widget applications, same unfortunate result.

  • @Dan-Bumbarger

    Sounds something with your setup is mixed up.

    What is the pre-compiled version you using?

  • I used the online installer, which installed this version:

    Qt Creator 4.4.1
    Based on Qt 5.9.2 (MSVC 2015, 32 bit)

    Built on Oct 4 2017 04:12:53

    From revision 6afdb8bdf9

    Does it matter that it installed based on MSVC 2015 32 bit rather than 64 bit?

  • Qt Champions 2018

    @Dan-Bumbarger This is QtCreator version not Qt version.
    Which exact Qt version do you use?
    MSVC 2015 32 is fine even on 64bit Windows.

  • I'm running 5.9.2..

  • @Dan-Bumbarger

    I would suggest to post the compile and link output for a small "hello world" program. Possibly someone can see the eventual differences and why the error occurs.

  • @Dan-Bumbarger
    qtmaind.lib will be a debug library; in release build it will doubtless use qtmain.lib instead. In some shape or form it can find the latter but not the former. You might look at Qt area to see if & where you can find either/both of these files.

    If it's quick & easy to do, you might uninstall your Qt and reinstall, just to see if it fixes or you get any error messages while installing.

  • From the compile output:
    link /LIBPATH:"c:\Users\acrob\Anaconda3\Library\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='' publicKeyToken='6595b64144ccf1df' language='' processorArchitecture=''" /OUT:debug\playingqtwidgets.exe @C:\Users\acrob\AppData\Local\Temp\playingqtwidgets.exe.17396.969.jom
    LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
    jom: C:\Users\acrob\Documents\build-playingqtwidgets-Desktop-Debug\Makefile.Debug [debug\playingqtwidgets.exe] Error 1104
    jom: C:\Users\acrob\Documents\build-playingqtwidgets-Desktop-Debug\Makefile [debug] Error 2
    18:38:04: The process "C:\Qt\Qt5.9.2\Tools\QtCreator\bin\jom.exe" exited with code 2.

    and there is indeed no qtmaind.lib (there is a qtmain for release..). Strange thing is, I don't remember the option for the install telling it to install everything in Anaconda? My intention is mostly to be using it with C++ in either QTcreator or Visual Studio, though I already had Anaconda installed for a python project..

  • I am thinking that hte QT5.9.2 did not install correctly (I can't find any qtmain.exe in there..) , so it finds the only installation that it can, which is the one that installed with Anaconda.. I am going to try and uninstall, reinstall and pay closer to options...

  • Yup, that's what it was... opening up the "QT" tickbox in the installer, I could see that it installed nothing but hte toolbox, likely because it had found this old version. Problem solved! I appreciate the friendly kick in the right direction!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.