Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Linking problem with C static Library
Qt 6.11 is out! See what's new in the release blog

Linking problem with C static Library

Scheduled Pinned Locked Moved Language Bindings
4 Posts 3 Posters 2.8k 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.
  • T Offline
    T Offline
    thahir1986
    wrote on last edited by
    #1

    Hi,

    I'm trying to use the classicladder plc as a library in my sample application. Classicladder is developed using the C programming language.

    But when i trying to compile , i got the linking undefined reference error , please help me guys,

    @g++ -Wl,-O1 -Wl,-rpath,/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o checkClassicLadder2 main.o checkclassicladder2.o moc_checkclassicladder2.o -L/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -L../../../Downloads/classicladder -lladder -lQtGui -L/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -L/usr/X11R6/lib -lQtCore -lpthread
    checkclassicladder2.o: In function checkClassicLadder2::checkClassicLadder2(QWidget*)': checkclassicladder2.cpp:(.text+0x112): undefined reference to ClassicLadder_AllocAll()'
    checkclassicladder2.o: In function checkClassicLadder2::checkClassicLadder2(QWidget*)': checkclassicladder2.cpp:(.text+0x3c2): undefined reference to ClassicLadder_AllocAll()'
    collect2: ld returned 1 exit status
    make: *** [checkClassicLadder2] Error 1
    @

    thanks

    yet not start ;)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      guziemic
      wrote on last edited by
      #2

      Hi,

      How you .pro file looks?
      Did you add library in which ClassicLadder_AllocAll() is defined?

      BR

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thahir1986
        wrote on last edited by
        #3

        sorry for the late reply

        yes i did add the library which contains the ClassicLadder_AllocAll(). But in the library it declared with the extern keyword

        yet not start ;)

        1 Reply Last reply
        0
        • F Offline
          F Offline
          franku
          wrote on last edited by
          #4

          What about the C-Library header file?

          You may need the 'external "C" {};' declaration for the methods provided in pure C like this:
          @
          #ifdef cplusplus
          external "C" {
          #endif

          void C_method1(void);

          #ifdef cplusplus
          };
          #endif
          @

          This, Jen, is the internet.

          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