Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] LINK : fatal error LNK1181: cannot open input file 'moduleA.lib'
QtWS25 Last Chance

[Solved] LINK : fatal error LNK1181: cannot open input file 'moduleA.lib'

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 13.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.
  • X Offline
    X Offline
    xtingray
    wrote on 25 Aug 2014, 04:38 last edited by
    #1

    This is my situation: I developed a library with two modules using these settings:
    @
    moduleA.pro :
    CONFIG += warn_on dll
    TEMPLATE = lib
    TARGET = moduleA

    moduleB.pro :
    CONFIG += warn_on dll
    TEMPLATE = lib
    TARGET = moduleB
    INCLUDEPATH += ..\moduleA
    LIBS += -L..\moduleA\release\ -lmoduleA
    @

    Note: module B depends on module A

    I have two environments to compile the same code:

    a) Windows7 32bit + Qt5.3.1 + MinGw32 : The compilation is clean and I got moduleA.dll and moduleB.dll working perfectly.

    b) Windows7 64bit + Qt5.3.1 64bit + MSV2013 : The module A is compiled pretty clean but I got the next error message while the compiler try to link the module B: LINK : fatal error LNK1181: cannot open input file 'moduleA.lib'

    I was looking for the file moduleA.lib in the whole filesystem but I just could find the file moduleA.dll. I am starting to believe that Qt5.3.1 (64bit) only can create static libraries but it's just a hypothesis.

    What is wrong in the b) environment?

    Thanks.


    Qt Developer

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Aug 2014, 16:41 last edited by
      #2

      Hi,

      Nothing is wrong with b. However there's a catch with MSVC. Are you properly exporting your classes/functions ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xtingray
        wrote on 25 Aug 2014, 17:49 last edited by
        #3

        Hi,

        When I was making the port of the code from Linux to Windows for the first time I had several issues related to how to export my classes. But after the fix, the compilation using MinGW was pretty clean.

        This is how I do it:
        @
        #if defined(QT_SHARED) || defined(QT_PLUGIN)
        #define MYPROJECT_EXPORT Q_DECL_EXPORT
        #endif

        class MYPROJECT_EXPORT ClassExample : public QObject
        {
        }
        @

        The thing that I can't understand is this: Why MVS2013 is looking for a .lib file if I am building a shared library (dll)?


        Qt Developer

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 25 Aug 2014, 20:12 last edited by
          #4

          You should rather have something like

          @
          #if defined(BUILD_MYPROJECT_LIB)

          define MYPROJECT_EXPORT Q_DECL_EXPORT

          #else

          define MYPROJECT_EXPORT Q_DECL_IMPORT

          #endif
          @

          QT_SHARED has no implication on the build type of your library. You can created a static library using a dynamic Qt.

          The exportation is done at build time. So you have to define BUILD_MYPROJECT_LIB when compiling your library

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xtingray
            wrote on 26 Aug 2014, 15:43 last edited by
            #5

            Thank you for the hint! :)


            Qt Developer

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 26 Aug 2014, 20:02 last edited by
              #6

              You're welcome !

              Since you seem to have your libs working, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              1/6

              25 Aug 2014, 04:38

              • Login

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