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. the ".a" library and it's functions not recognized after being added to project
Forum Updated to NodeBB v4.3 + New Features

the ".a" library and it's functions not recognized after being added to project

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 348 Views 2 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.
  • S Offline
    S Offline
    Sedsimorgh
    wrote on last edited by Sedsimorgh
    #1

    Hello to all fellow community members

    i've just added a ".a" library made out of a cpp file to my project . the library is created within my project using these lines:
    //=================
    TEMPLATE = lib
    CONFIG += staticlib
    //=================

    then i tried to add this library to the same project and the functions of library are NOT recognized, causing errors like undefined reference to functions.

    in .pro file, these lines are added to locate and define the library (done by "add library" wizard)

    //===================================================================================
    win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../Calibration/release/ -lCalibration
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../Calibration/debug/ -lCalibration
    else:unix: LIBS += -L$$OUT_PWD/../Calibration/ -lCalibration

    INCLUDEPATH += $$PWD/../Calibration
    DEPENDPATH += $$PWD/../Calibration

    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../Calibration/release/libCalibration.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../Calibration/debug/libCalibration.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../Calibration/release/Calibration.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../Calibration/debug/Calibration.lib
    else:unix: PRE_TARGETDEPS += $$OUT_PWD/../Calibration/libCalibration.a
    //===================================================================================

    what am i doing wrong?
    feel free to ask for more info.

    Regards
    Seyed

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by SGaist
      #2

      Hi and welcome to devnet,

      Just to be sure I understand correctly, are you using a SUBDIRS based project ?

      If so, are you sure you are building them in the correct order ?

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

      S 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Just to be sure I understand correctly, are you using a SUBDIRS based project ?

        If so, are you sure you are building them in the correct order ?

        S Offline
        S Offline
        Sedsimorgh
        wrote on last edited by Sedsimorgh
        #3

        @SGaist thanks for reply

        the project tree looks like this:

        Screenshot 2024-07-08 094116.png

        each subdirectory has it's own .pro , source and headers folder.
        there are some cpp files in "api" section which i'm trying to convert them to "one" library to avoid exposing some sources and use that library in "example" files. there are classes, functions in the "api" .

        and i didn't quite understand. you meant the correct order of creating subdirs or the library?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sedsimorgh
          wrote on last edited by
          #4

          Solved. i just didn't placed all the required ".h" headers in the new project.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Glad you found out :-)

            Please mark the thread as 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

            S 1 Reply Last reply
            0
            • S Sedsimorgh has marked this topic as solved on
            • SGaistS SGaist

              Glad you found out :-)

              Please mark the thread as solved so other forum users may know a solution has been found :-)

              S Offline
              S Offline
              Sedsimorgh
              wrote on last edited by
              #6

              @SGaist done

              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