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. Why default Qt linker cannot link to libraries
Forum Updated to NodeBB v4.3 + New Features

Why default Qt linker cannot link to libraries

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.3k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    francoatmega
    wrote on last edited by kshegunov
    #1

    i'am developing a project and every external libraries I trie to use the same errors appears...
    Unsolved reference, the linker cannot find the library that a specifie in the LIBS variable of os .pro file.

    Below my .pro file and the linker error:

    .pro file

    QT       += core gui
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = WanGlacier2
    TEMPLATE = app
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    INCLUDEPATH += \
        D:\3include \
    
    LIBS += \
        -LD:\1libs \
        -laws-cpp-sdk-core
    
    SOURCES += \
            main.cpp \
        wanconfig.cpp \
        wanconfigbd.cpp \
        wanconfigaws.cpp \
        waninicial.cpp
    
    HEADERS += \
        wanconfig.h \
        wanconfigbd.h \
        wanconfigaws.h \
        waninicial.h
    
    FORMS += \
        wanconfig.ui \
        wanconfigbd.ui \
        wanconfigaws.ui \
        waninicial.ui
    

    .pro file

    Linker error

    00:34:36: Running steps for project WanGlacier2...
    00:34:36: Configuration unchanged, skipping qmake step.
    00:34:36: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" 
    C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory 'C:/Users/francoatmega/Documents/build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
    g++ -Wl,-subsystem,windows -mthreads -o debug/WanGlacier2.exe debug/main.o debug/wanconfig.o debug/wanconfigbd.o debug/wanconfigaws.o debug/waninicial.o debug/moc_wanconfig.o debug/moc_wanconfigbd.o debug/moc_wanconfigaws.o debug/moc_waninicial.o  -lmingw32 -LC:/Qt/5.9.1/mingw53_32/lib C:/Qt/5.9.1/mingw53_32/lib/libqtmaind.a -LC:/utils/my_sql/my_sql/lib -LC:/utils/postgresql/pgsql/lib -lshell32 C:/Qt/5.9.1/mingw53_32/lib/libQt5Cored.a -LD:/1libs -laws-cpp-sdk-core C:/Qt/5.9.1/mingw53_32/lib/libQt5Widgetsd.a C:/Qt/5.9.1/mingw53_32/lib/libQt5Guid.a C:/Qt/5.9.1/mingw53_32/lib/libQt5Cored.a 
    debug/main.o: In function `Z5qMainiPPc':
    C:\Users\francoatmega\Documents\build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug/../WanGlacier2/main.cpp:43: undefined reference to `Aws::InitAPI(Aws::SDKOptions const&)'
    C:\Users\francoatmega\Documents\build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug/../WanGlacier2/main.cpp:45: undefined reference to `Aws::ShutdownAPI(Aws::SDKOptions const&)'
    collect2.exe: error: ld returned 1 exit status
    Makefile.Debug:85: recipe for target 'debug/WanGlacier2.exe' failed
    mingw32-make[1]: Leaving directory 'C:/Users/francoatmega/Documents/build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
    Makefile:36: recipe for target 'debug' failed
    mingw32-make[1]: *** [debug/WanGlacier2.exe] Error 1
    mingw32-make: *** [debug] Error 2
    00:34:39: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project WanGlacier2 (kit: Desktop Qt 5.9.1 MinGW 32bit)
    When executing step "Make"
    00:34:39: Elapsed time: 00:03.
    

    Linker Error

    [Added code tags ~kshegunov]

    kshegunovK 1 Reply Last reply
    0
    • F francoatmega

      i'am developing a project and every external libraries I trie to use the same errors appears...
      Unsolved reference, the linker cannot find the library that a specifie in the LIBS variable of os .pro file.

      Below my .pro file and the linker error:

      .pro file

      QT       += core gui
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      TARGET = WanGlacier2
      TEMPLATE = app
      
      # The following define makes your compiler emit warnings if you use
      # any feature of Qt which as been marked as deprecated (the exact warnings
      # depend on your compiler). Please consult the documentation of the
      # deprecated API in order to know how to port your code away from it.
      DEFINES += QT_DEPRECATED_WARNINGS
      
      # You can also make your code fail to compile if you use deprecated APIs.
      # In order to do so, uncomment the following line.
      # You can also select to disable deprecated APIs only up to a certain version of Qt.
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
      
      INCLUDEPATH += \
          D:\3include \
      
      LIBS += \
          -LD:\1libs \
          -laws-cpp-sdk-core
      
      SOURCES += \
              main.cpp \
          wanconfig.cpp \
          wanconfigbd.cpp \
          wanconfigaws.cpp \
          waninicial.cpp
      
      HEADERS += \
          wanconfig.h \
          wanconfigbd.h \
          wanconfigaws.h \
          waninicial.h
      
      FORMS += \
          wanconfig.ui \
          wanconfigbd.ui \
          wanconfigaws.ui \
          waninicial.ui
      

      .pro file

      Linker error

      00:34:36: Running steps for project WanGlacier2...
      00:34:36: Configuration unchanged, skipping qmake step.
      00:34:36: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" 
      C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
      mingw32-make[1]: Entering directory 'C:/Users/francoatmega/Documents/build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
      g++ -Wl,-subsystem,windows -mthreads -o debug/WanGlacier2.exe debug/main.o debug/wanconfig.o debug/wanconfigbd.o debug/wanconfigaws.o debug/waninicial.o debug/moc_wanconfig.o debug/moc_wanconfigbd.o debug/moc_wanconfigaws.o debug/moc_waninicial.o  -lmingw32 -LC:/Qt/5.9.1/mingw53_32/lib C:/Qt/5.9.1/mingw53_32/lib/libqtmaind.a -LC:/utils/my_sql/my_sql/lib -LC:/utils/postgresql/pgsql/lib -lshell32 C:/Qt/5.9.1/mingw53_32/lib/libQt5Cored.a -LD:/1libs -laws-cpp-sdk-core C:/Qt/5.9.1/mingw53_32/lib/libQt5Widgetsd.a C:/Qt/5.9.1/mingw53_32/lib/libQt5Guid.a C:/Qt/5.9.1/mingw53_32/lib/libQt5Cored.a 
      debug/main.o: In function `Z5qMainiPPc':
      C:\Users\francoatmega\Documents\build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug/../WanGlacier2/main.cpp:43: undefined reference to `Aws::InitAPI(Aws::SDKOptions const&)'
      C:\Users\francoatmega\Documents\build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug/../WanGlacier2/main.cpp:45: undefined reference to `Aws::ShutdownAPI(Aws::SDKOptions const&)'
      collect2.exe: error: ld returned 1 exit status
      Makefile.Debug:85: recipe for target 'debug/WanGlacier2.exe' failed
      mingw32-make[1]: Leaving directory 'C:/Users/francoatmega/Documents/build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
      Makefile:36: recipe for target 'debug' failed
      mingw32-make[1]: *** [debug/WanGlacier2.exe] Error 1
      mingw32-make: *** [debug] Error 2
      00:34:39: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
      Error while building/deploying project WanGlacier2 (kit: Desktop Qt 5.9.1 MinGW 32bit)
      When executing step "Make"
      00:34:39: Elapsed time: 00:03.
      

      Linker Error

      [Added code tags ~kshegunov]

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @francoatmega said in Why default Qt linker cannot link to libraries:

      LIBS += \
          -LD:\1libs \
      

      Perhaps you meant to write:

      -LD:/1libs \
      

      You don't use backslashes but forward slashes with qmake.

      Read and abide by the Qt Code of Conduct

      F 1 Reply Last reply
      0
      • kshegunovK kshegunov

        @francoatmega said in Why default Qt linker cannot link to libraries:

        LIBS += \
            -LD:\1libs \
        

        Perhaps you meant to write:

        -LD:/1libs \
        

        You don't use backslashes but forward slashes with qmake.

        F Offline
        F Offline
        francoatmega
        wrote on last edited by
        #3

        @kshegunov Same error bro...
        And I was looking the the mingw32-make use backslash:

        mingw32-make[1]: Entering directory 'C:/Users/francoatmega/Documents/build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
        g++ -Wl,-subsystem,windows -mthreads -o debug\WanGlacier2.exe debug/main.o debug/wanconfig.o debug/wanconfigbd.o debug/wanconfigaws.o debug/waninicial.o debug/moc_wanconfig.o debug/moc_wanconfigbd.o debug/moc_wanconfigaws.o debug/moc_waninicial.o -lmingw32 -LC:\Qt\5.9.1\mingw53_32\lib C:\Qt\5.9.1\mingw53_32\lib\libqtmaind.a -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -lshell32 -LD:\1libs -laws-cpp-sdk-core C:\Qt\5.9.1\mingw53_32\lib\libQt5Widgetsd.a C:\Qt\5.9.1\mingw53_32\lib\libQt5Guid.a C:\Qt\5.9.1\mingw53_32\lib\libQt5Cored.a

        I think that this error can be because I 'am triyng to compile a library who was made on Visual Studio. What do you think?

        kshegunovK 1 Reply Last reply
        0
        • F francoatmega

          @kshegunov Same error bro...
          And I was looking the the mingw32-make use backslash:

          mingw32-make[1]: Entering directory 'C:/Users/francoatmega/Documents/build-WanGlacier2-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
          g++ -Wl,-subsystem,windows -mthreads -o debug\WanGlacier2.exe debug/main.o debug/wanconfig.o debug/wanconfigbd.o debug/wanconfigaws.o debug/waninicial.o debug/moc_wanconfig.o debug/moc_wanconfigbd.o debug/moc_wanconfigaws.o debug/moc_waninicial.o -lmingw32 -LC:\Qt\5.9.1\mingw53_32\lib C:\Qt\5.9.1\mingw53_32\lib\libqtmaind.a -LC:\utils\my_sql\my_sql\lib -LC:\utils\postgresql\pgsql\lib -lshell32 -LD:\1libs -laws-cpp-sdk-core C:\Qt\5.9.1\mingw53_32\lib\libQt5Widgetsd.a C:\Qt\5.9.1\mingw53_32\lib\libQt5Guid.a C:\Qt\5.9.1\mingw53_32\lib\libQt5Cored.a

          I think that this error can be because I 'am triyng to compile a library who was made on Visual Studio. What do you think?

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @francoatmega said in Why default Qt linker cannot link to libraries:

          I think that this error can be because I 'am triyng to compile a library who was made on Visual Studio.

          This is most definitely it. You can't mix compilers, you have to compile your app with a matching compiler or your library with mingw.

          Read and abide by the Qt Code of Conduct

          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