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. undefined reference to _imp_

undefined reference to _imp_

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.8k 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.
  • D Offline
    D Offline
    dansab
    wrote on last edited by
    #1

    Dear Forum,

    I know that there are forum posts with similar topics but I did not found a solution so far.

    I have an external .lib to include to my project. I am using MinGW 64bit and Qt 5.15.0
    I used the function "Add Library", selected external and selected the .lib.

    unix:!macx|win32: LIBS += -L$$PWD/./ -llibe9u_LSMD_x64
    
    INCLUDEPATH += $$PWD/.
    DEPENDPATH += $$PWD/.
    

    Now I get multiple "undefinde reference to imp" errors. The supplier of the lib says that it was created using a cross compiler.

    I found this:
    https://stackoverflow.com/questions/30767553/undefined-reference-when-using-c11-qmake-flags

    And added:

    QMAKE_CXXFLAGS += -std=c++11
    CONFIG += c++11
    

    But that did not help.

    The lib works with Visual Studio. I also tried Qt VS Tools, but that also generated LNK2019 errors.

    Any help appreciated.

    Thanks!
    Dan

    JonBJ 1 Reply Last reply
    0
    • D dansab

      Dear Forum,

      I know that there are forum posts with similar topics but I did not found a solution so far.

      I have an external .lib to include to my project. I am using MinGW 64bit and Qt 5.15.0
      I used the function "Add Library", selected external and selected the .lib.

      unix:!macx|win32: LIBS += -L$$PWD/./ -llibe9u_LSMD_x64
      
      INCLUDEPATH += $$PWD/.
      DEPENDPATH += $$PWD/.
      

      Now I get multiple "undefinde reference to imp" errors. The supplier of the lib says that it was created using a cross compiler.

      I found this:
      https://stackoverflow.com/questions/30767553/undefined-reference-when-using-c11-qmake-flags

      And added:

      QMAKE_CXXFLAGS += -std=c++11
      CONFIG += c++11
      

      But that did not help.

      The lib works with Visual Studio. I also tried Qt VS Tools, but that also generated LNK2019 errors.

      Any help appreciated.

      Thanks!
      Dan

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

      @dansab
      Are these .lib files giving "imp..." warnings from MSVC and you are trying to link them with MinGW?

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dansab
        wrote on last edited by
        #3

        Hi JonB,

        the problem was, that some .h were written in C, so this problem was solved by

        extern "C"
        {
        #include...
        }
        

        This error message is incredible unspecific...
        Shouldn't a C or C++ compiler be able to recognize this?

        cheers,
        Dan

        Christian EhrlicherC 1 Reply Last reply
        0
        • D dansab

          Hi JonB,

          the problem was, that some .h were written in C, so this problem was solved by

          extern "C"
          {
          #include...
          }
          

          This error message is incredible unspecific...
          Shouldn't a C or C++ compiler be able to recognize this?

          cheers,
          Dan

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @dansab said in undefined reference to _imp_:

          Shouldn't a C or C++ compiler be able to recognize this?

          How? You told the compiler that you're using a c++ function, but the library only exported the c name - how should a linker (not compiler btw) know about this - these are two different symbols for them.

          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
          0

          • Login

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