Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. VS2022 + Qt 5.15.2: cannot open file qtmaind.lib

VS2022 + Qt 5.15.2: cannot open file qtmaind.lib

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
7 Posts 3 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LinkwitzRiley
    wrote on last edited by LinkwitzRiley
    #1

    Hi!
    I recently updated to Visual Studio 2022 and want to use the latest Qt5 along with it.
    It installed Qt with the online installer from scratch.

    Now as soon as I want to debug my code I get the linker error "cannot open file 'qtmaind.lib'.
    However, in my C:\Qt\5.15.2\msvc2019_64\lib the file is there.
    Can anyone help me resolve this or at least give me a hint on how to get additional information on the specific error?
    Thanks!

    JonBJ 1 Reply Last reply
    0
    • L LinkwitzRiley

      Hi!
      I recently updated to Visual Studio 2022 and want to use the latest Qt5 along with it.
      It installed Qt with the online installer from scratch.

      Now as soon as I want to debug my code I get the linker error "cannot open file 'qtmaind.lib'.
      However, in my C:\Qt\5.15.2\msvc2019_64\lib the file is there.
      Can anyone help me resolve this or at least give me a hint on how to get additional information on the specific error?
      Thanks!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @LinkwitzRiley said in VS2022 + Qt 5.15.2: cannot open file qtmaind.lib:

      "cannot open file 'qtmaind.lib'.

      When you say it's there, verify you are looking at qtmaind.lib, that d at the end, not just qtmain.lib?

      1 Reply Last reply
      1
      • L Offline
        L Offline
        LinkwitzRiley
        wrote on last edited by
        #3

        Thanks, @JonB!

        Both are there; C:\Qt\5.15.2\msvc2019_64\lib\qtmain.lib AND C:\Qt\5.15.2\msvc2019_64\lib\qtmaind.lib.
        I should add, that the project that cannot be debugged was initially created in VS2019 with Qt 5.14 and I just verified that Release doesn't work either and returns with 'cannot open input file "qtmain.lib"'.

        JonBJ 1 Reply Last reply
        0
        • L LinkwitzRiley

          Thanks, @JonB!

          Both are there; C:\Qt\5.15.2\msvc2019_64\lib\qtmain.lib AND C:\Qt\5.15.2\msvc2019_64\lib\qtmaind.lib.
          I should add, that the project that cannot be debugged was initially created in VS2019 with Qt 5.14 and I just verified that Release doesn't work either and returns with 'cannot open input file "qtmain.lib"'.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @LinkwitzRiley
          Let's be 100% clear about one thing: in all cases the "cannot open file ....lib" happens when you link, not when you attempt to run/debug your program, right?

          There seem to be only two (likely) possibilities for such an error message:

          1. It is simply not looking in the directory where you say the file resides.
          2. There is something "unacceptable" about that .lib file (such as wrong architecture or maybe different compiler versions) and it's giving a (slightly misleading) !cannot open" error message.

          First, if you have not already done so, clean/delete all files which might have been generated by previous VS version and rebuild from scratch. I don't know how VS sets you up, but if there is a "build output directory" --- we are looking particularly for .obj and maybe .def or .lnk` files --- you should be able to completely that directory, or all its content.

          Then if it still fails find whatever "compiler/linker output window you have". We want to see both (a) the complete link command line it is issuing and (b) the exact error message it then issues. Show that here (copy & paste) and we may be able to understand/guess what is going on.

          1 Reply Last reply
          0
          • L Offline
            L Offline
            LinkwitzRiley
            wrote on last edited by
            #5

            I just deleted all generated files by hand, that is the complete 'Debug' directory with all the .obj files in it.
            I get the same error and the output from VS looks like this:

            Build started...
            1>------ Build started: Project: GroundControlStationGUI, Configuration: Debug x64 ------
            1>Reading Qt configuration (C:/Qt/5.15.2/msvc2019_64/bin/qmake)
            1>Uic'ing groundcontrolstationgui.ui...
            1>Rcc'ing groundcontrolstationgui.qrc...
            1>Moc'ing groundcontrolstationgui.h...
            1>Moc'ing GenNtpTimeStamp.h...
            1>Moc'ing qntp\NtpClient.h...
            1> RCC: Warning: No resources in 'E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\groundcontrolstationgui.qrc'.
            1>ByteSwapUtilities.c
            1>Ccip.c
            1>CcipPortUserFunctionsEthernet.c
            1>CcipPortUserFunctionsUart.c
            1>CcipSdkBase.c
            1>CcipSdkGnss.c
            1>CcipSdkInterface.c
            1>CcipSdkTracker.c
            1>Crc8.c
            1>GeomagnetismLibrary.c
            1>RingBuffer.c
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1663,21): warning C4047: 'return': 'MAGtype_LegendreFunction *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1669,21): warning C4047: 'return': 'MAGtype_LegendreFunction *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1675,21): warning C4047: 'return': 'MAGtype_LegendreFunction *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1713,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1721,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1729,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1735,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1741,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\CcipSdkInterface.c(1255,57): warning C4133: 'function': incompatible types - from 'time_t *' to 'const __time32_t *'
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\CcipSdkInterface.c(434): warning C4700: uninitialized local variable 'pHeader' used
            1>CcipPortUserFunctionEthernetQt.cpp
            1>CcipTimestampGenWrapper.cpp
            1>GeneralPurposeCppWrappers.cpp
            1>GenNtpTimeStamp.cpp
            1>groundcontrolstationgui.cpp
            1>main.cpp
            1>NMEAParser.cpp
            1>NMEAParserPacket.cpp
            1>NMEASentenceBase.cpp
            1>NMEASentenceGGA.cpp
            1>NMEASentenceGSA.cpp
            1>NMEASentenceGSV.cpp
            1>NMEASentenceRMC.cpp
            1>NtpClient.cpp
            1>NtpReply.cpp
            1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\groundcontrolstationgui.cpp(1372,3): warning C4838: conversion from 'int' to 'u16' requires a narrowing conversion
            1>qrc_groundcontrolstationgui.cpp
            1>moc_groundcontrolstationgui.cpp
            1>moc_GenNtpTimeStamp.cpp
            1>moc_NtpClient.cpp
            1>e:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1092,5): error MSB6006: "link.exe" exited with code 1104.
            1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
            1>Done building project "GroundControlStationGUI.vcxproj" -- FAILED.
            ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
            

            Is there a possibility to get a more verbose output, maybe by building from console or similar?
            Thanks!

            JonBJ 1 Reply Last reply
            0
            • L LinkwitzRiley

              I just deleted all generated files by hand, that is the complete 'Debug' directory with all the .obj files in it.
              I get the same error and the output from VS looks like this:

              Build started...
              1>------ Build started: Project: GroundControlStationGUI, Configuration: Debug x64 ------
              1>Reading Qt configuration (C:/Qt/5.15.2/msvc2019_64/bin/qmake)
              1>Uic'ing groundcontrolstationgui.ui...
              1>Rcc'ing groundcontrolstationgui.qrc...
              1>Moc'ing groundcontrolstationgui.h...
              1>Moc'ing GenNtpTimeStamp.h...
              1>Moc'ing qntp\NtpClient.h...
              1> RCC: Warning: No resources in 'E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\groundcontrolstationgui.qrc'.
              1>ByteSwapUtilities.c
              1>Ccip.c
              1>CcipPortUserFunctionsEthernet.c
              1>CcipPortUserFunctionsUart.c
              1>CcipSdkBase.c
              1>CcipSdkGnss.c
              1>CcipSdkInterface.c
              1>CcipSdkTracker.c
              1>Crc8.c
              1>GeomagnetismLibrary.c
              1>RingBuffer.c
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1663,21): warning C4047: 'return': 'MAGtype_LegendreFunction *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1669,21): warning C4047: 'return': 'MAGtype_LegendreFunction *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1675,21): warning C4047: 'return': 'MAGtype_LegendreFunction *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1713,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1721,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1729,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1735,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\GeomagnetismLibrary.c(1741,21): warning C4047: 'return': 'MAGtype_MagneticModel *' differs in levels of indirection from 'int'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\CcipSdkInterface.c(1255,57): warning C4133: 'function': incompatible types - from 'time_t *' to 'const __time32_t *'
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\CcipSdkInterface.c(434): warning C4700: uninitialized local variable 'pHeader' used
              1>CcipPortUserFunctionEthernetQt.cpp
              1>CcipTimestampGenWrapper.cpp
              1>GeneralPurposeCppWrappers.cpp
              1>GenNtpTimeStamp.cpp
              1>groundcontrolstationgui.cpp
              1>main.cpp
              1>NMEAParser.cpp
              1>NMEAParserPacket.cpp
              1>NMEASentenceBase.cpp
              1>NMEASentenceGGA.cpp
              1>NMEASentenceGSA.cpp
              1>NMEASentenceGSV.cpp
              1>NMEASentenceRMC.cpp
              1>NtpClient.cpp
              1>NtpReply.cpp
              1>E:\VisualStudioProjects\Qtmavlink_test\Visual Studio\GroundControlStationGUI\groundcontrolstationgui.cpp(1372,3): warning C4838: conversion from 'int' to 'u16' requires a narrowing conversion
              1>qrc_groundcontrolstationgui.cpp
              1>moc_groundcontrolstationgui.cpp
              1>moc_GenNtpTimeStamp.cpp
              1>moc_NtpClient.cpp
              1>e:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1092,5): error MSB6006: "link.exe" exited with code 1104.
              1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
              1>Done building project "GroundControlStationGUI.vcxproj" -- FAILED.
              ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
              

              Is there a possibility to get a more verbose output, maybe by building from console or similar?
              Thanks!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @LinkwitzRiley said in VS2022 + Qt 5.15.2: cannot open file qtmaind.lib:

              Is there a possibility to get a more verbose output, maybe by building from console or similar?

              Exactly! Because I do not even see the actual link line being executed! I know nothing about VS here, sorry.

              You might gain some idea from Googling: "link.exe" exited with code 1104 or maybe error MSB6006. Good luck!

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Make sure the Qt libpath is really added to your linker options -> https://docs.microsoft.com/en-us/cpp/build/reference/libpath-additional-libpath

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                1

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved