Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. undefined reference - Help first time external header library QT C++ [Linux]

undefined reference - Help first time external header library QT C++ [Linux]

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
c++libraryreference error
14 Posts 3 Posters 2.4k 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.
  • LudoFRL LudoFR

    Hello everyone, sorry to bother,

    I have used sometimes ago QT with QtQcuickC++ and loved it, its ok for me using it with "raw c++" but this time I need to use external header from a vendor API and I have pain to understand the process.

    Here what I've do and what i get :

    Added the include to my project folder.

    b1c6d734-495f-4ec0-aac0-75383af4798f-image.png

    a47e7dc4-2158-44cb-86f5-fd641ef7a7b7-image.png

    After, added the header file to my project and to my *.pro :

    f91a6e7a-19cd-42b3-9956-7f0464cb5cb0-image.png

    QT += quick
    
    SOURCES += \
            main.cpp
    
    resources.files = main.qml 
    resources.prefix = /$${TARGET}
    RESOURCES += resources
    
    # Additional import path used to resolve QML modules in Qt Creator's code model
    QML_IMPORT_PATH =
    
    # Additional import path used to resolve QML modules just for Qt Quick Designer
    QML_DESIGNER_IMPORT_PATH =
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    &
    
    HEADERS += \
        include/delib.h \
        include/delib_error_codes.h
    
    

    This is my main.cpp file where I try to use them :

    #include <QGuiApplication>
    #include <QQmlContext>
    #include <QQuickView>
    
    #include "include/delib.h"
    
    QQuickView *view;
    int main(int argc, char *argv[])
    {
        QGuiApplication app(argc, argv);
    
    
        view = new QQuickView();
        view->setSource(QUrl::fromLocalFile("../DeditecQuickCpp/main.qml"));
    
        DAPI_OPENMODULEEX_STRUCT deditecStruct;
        strcpy((char*) deditecStruct.address,"192.168.1.100");
        deditecStruct.portno = 1934;
        deditecStruct.timeout = 5000;
        deditecStruct.encryption_type = 0;
    
        //ULONG deditecHandle = DapiOpenModule()
        ULONG deditecHandle = DapiOpenModuleEx(NET_ETH_LC,0,(unsigned char*)&deditecStruct,0);
    
        printf("Module handle = %lx\n", deditecHandle);
    
    
        view->show();
        return app.exec();
    }
    

    I got his error here (line 23):

    80e069ff-ea4e-4a37-8af0-dd31bf233fd0-image.png

    Here inside my delib.h (Line 423)
    5a1f4dfb-1088-4be0-b7d9-92216c4bcc93-image.png

    I've also see the error ":-1: error: [Makefile:212: DeditecQuickCpp] Error 1" into the issues window.

    Here my lines 211/212 from my Makefile :

    DeditecQuickCpp:  $(OBJECTS)  
    	$(LINK) $(LFLAGS) -o $(TARGET)  $(OBJECTS) $(OBJCOMP) $(LIBS)
    

    The autocomplet found "DapiOpenModuleEx" by the way.

    Before compilation I've try to qun qmake but the output result is this :

    16:42:54: Running steps for project DeditecQuickCpp...
    16:42:54: Starting: "/home/ludo/Qt/6.4.2/gcc_64/bin/qmake" /home/ludo/Documents/Dev_C/QT/DeditecQuickCpp/DeditecQuickCpp.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
    16:42:54: The process "/home/ludo/Qt/6.4.2/gcc_64/bin/qmake" exited normally.
    16:42:54: Starting: "/usr/bin/make" -f /home/ludo/Documents/Dev_C/QT/build-DeditecQuickCpp-Desktop_Qt_6_4_2_GCC_64bit-Debug/Makefile qmake_all
    make: Nothing to be done for 'qmake_all'.
    16:42:54: The process "/usr/bin/make" exited normally.
    16:42:54: Elapsed time: 00:00.
    

    sorry if my question is dumb, but could you have sometimes for helping me please.

    I want to thank you in advance for your time.

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

    @LudoFR
    Does it help if you write it as ::DapiOpenModuleEx(...)?
    As @SGaist says below. I didn't notice it was a linker error.

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

      Hi,

      Aren't you forgetting to link to the library that provided these symbols ?

      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
      1
      • LudoFRL Offline
        LudoFRL Offline
        LudoFR
        wrote on last edited by LudoFR
        #4

        @JonB said in undefined reference - Help first time external header library QT C++ [Linux]:

        @LudoFR
        Does it help if you write it as ::DapiOpenModuleEx(...)?
        As @SGaist says below. I didn't notice it was a linker error.

        @SGaist said in undefined reference - Help first time external header library QT C++ [Linux]:

        Hi,

        Aren't you forgetting to link to the library that provided these symbols ?

        damn yea right..

        I have the added full library folder into my project folder like this :
        d47c753b-bda1-4dd9-8fec-a4ce92fb5ba1-image.png

        Now my *.pro file :

        QT += quick
        
        SOURCES += \
                main.cpp
        
        resources.files = main.qml 
        resources.prefix = /$${TARGET}
        RESOURCES += resources
        
        # Additional import path used to resolve QML modules in Qt Creator's code model
        QML_IMPORT_PATH =
        
        # Additional import path used to resolve QML modules just for Qt Quick Designer
        QML_DESIGNER_IMPORT_PATH =
        
        # Default rules for deployment.
        qnx: target.path = /tmp/$${TARGET}/bin
        else: unix:!android: target.path = /opt/$${TARGET}/bin
        !isEmpty(target.path): INSTALLS += target
        &
        
        unix:!macx: LIBS += -L$$PWD/delib/lib/build_x64/ -lDelibTcp
        
        INCLUDEPATH += $$PWD/delib
        DEPENDPATH += $$PWD/delib
        

        and my compile ouput window :

        08:54:36: Running steps for project DeditecQuickCpp...
        08:54:36: Configuration unchanged, skipping qmake step.
        08:54:36: Starting: "/usr/bin/make" -j20
        g++ -c -pipe -g -Wall -Wextra -fPIC -D_REENTRANT -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QMLINTEGRATION_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../DeditecQuickCpp -I. -I../DeditecQuickCpp/delib -I../../../../Qt/6.4.2/gcc_64/include -I../../../../Qt/6.4.2/gcc_64/include/QtQuick -I../../../../Qt/6.4.2/gcc_64/include/QtOpenGL -I../../../../Qt/6.4.2/gcc_64/include/QtGui -I../../../../Qt/6.4.2/gcc_64/include/QtQmlModels -I../../../../Qt/6.4.2/gcc_64/include/QtQml -I../../../../Qt/6.4.2/gcc_64/include/QtQmlIntegration -I../../../../Qt/6.4.2/gcc_64/include/QtNetwork -I../../../../Qt/6.4.2/gcc_64/include/QtCore -I. -I../../../../Qt/6.4.2/gcc_64/mkspecs/linux-g++ -o main.o ../DeditecQuickCpp/main.cpp
        In file included from ../DeditecQuickCpp/main.cpp:5:
        ../DeditecQuickCpp/delib/library/delib/delib.h:347:53: note: ‘#pragma message: DELIB.H Mode for C++ used’
          347 |         #pragma message ("DELIB.H Mode for C++ used")
              |                                                     ^
        g++ -Wl,-rpath,/home/ludo/Qt/6.4.2/gcc_64/lib -Wl,-rpath-link,/home/ludo/Qt/6.4.2/gcc_64/lib -o DeditecQuickCpp  main.o qrc_qmake_resources.o   -L/home/ludo/Documents/Dev_C/QT/DeditecQuickCpp/delib/lib/build_x64/ -lDelibTcp /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Quick.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6OpenGL.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Gui.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6QmlModels.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Qml.so -pthread /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Network.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Core.so -lpthread -lGL   
        /usr/bin/ld: main.o: in function `main':
        /home/ludo/Documents/Dev_C/QT/build-DeditecQuickCpp-Desktop_Qt_6_4_2_GCC_64bit-Debug/../DeditecQuickCpp/main.cpp:23: undefined reference to `DapiOpenModuleEx'
        collect2: error: ld returned 1 exit status
        make: *** [Makefile:211: DeditecQuickCpp] Error 1
        08:54:37: The process "/usr/bin/make" exited with code 2.
        Error while building/deploying project DeditecQuickCpp (kit: Desktop Qt 6.4.2 GCC 64bit)
        When executing step "Make"
        08:54:37: Elapsed time: 00:01.
        
        JonBJ 1 Reply Last reply
        0
        • LudoFRL LudoFR

          @JonB said in undefined reference - Help first time external header library QT C++ [Linux]:

          @LudoFR
          Does it help if you write it as ::DapiOpenModuleEx(...)?
          As @SGaist says below. I didn't notice it was a linker error.

          @SGaist said in undefined reference - Help first time external header library QT C++ [Linux]:

          Hi,

          Aren't you forgetting to link to the library that provided these symbols ?

          damn yea right..

          I have the added full library folder into my project folder like this :
          d47c753b-bda1-4dd9-8fec-a4ce92fb5ba1-image.png

          Now my *.pro file :

          QT += quick
          
          SOURCES += \
                  main.cpp
          
          resources.files = main.qml 
          resources.prefix = /$${TARGET}
          RESOURCES += resources
          
          # Additional import path used to resolve QML modules in Qt Creator's code model
          QML_IMPORT_PATH =
          
          # Additional import path used to resolve QML modules just for Qt Quick Designer
          QML_DESIGNER_IMPORT_PATH =
          
          # Default rules for deployment.
          qnx: target.path = /tmp/$${TARGET}/bin
          else: unix:!android: target.path = /opt/$${TARGET}/bin
          !isEmpty(target.path): INSTALLS += target
          &
          
          unix:!macx: LIBS += -L$$PWD/delib/lib/build_x64/ -lDelibTcp
          
          INCLUDEPATH += $$PWD/delib
          DEPENDPATH += $$PWD/delib
          

          and my compile ouput window :

          08:54:36: Running steps for project DeditecQuickCpp...
          08:54:36: Configuration unchanged, skipping qmake step.
          08:54:36: Starting: "/usr/bin/make" -j20
          g++ -c -pipe -g -Wall -Wextra -fPIC -D_REENTRANT -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QMLINTEGRATION_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../DeditecQuickCpp -I. -I../DeditecQuickCpp/delib -I../../../../Qt/6.4.2/gcc_64/include -I../../../../Qt/6.4.2/gcc_64/include/QtQuick -I../../../../Qt/6.4.2/gcc_64/include/QtOpenGL -I../../../../Qt/6.4.2/gcc_64/include/QtGui -I../../../../Qt/6.4.2/gcc_64/include/QtQmlModels -I../../../../Qt/6.4.2/gcc_64/include/QtQml -I../../../../Qt/6.4.2/gcc_64/include/QtQmlIntegration -I../../../../Qt/6.4.2/gcc_64/include/QtNetwork -I../../../../Qt/6.4.2/gcc_64/include/QtCore -I. -I../../../../Qt/6.4.2/gcc_64/mkspecs/linux-g++ -o main.o ../DeditecQuickCpp/main.cpp
          In file included from ../DeditecQuickCpp/main.cpp:5:
          ../DeditecQuickCpp/delib/library/delib/delib.h:347:53: note: ‘#pragma message: DELIB.H Mode for C++ used’
            347 |         #pragma message ("DELIB.H Mode for C++ used")
                |                                                     ^
          g++ -Wl,-rpath,/home/ludo/Qt/6.4.2/gcc_64/lib -Wl,-rpath-link,/home/ludo/Qt/6.4.2/gcc_64/lib -o DeditecQuickCpp  main.o qrc_qmake_resources.o   -L/home/ludo/Documents/Dev_C/QT/DeditecQuickCpp/delib/lib/build_x64/ -lDelibTcp /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Quick.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6OpenGL.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Gui.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6QmlModels.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Qml.so -pthread /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Network.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Core.so -lpthread -lGL   
          /usr/bin/ld: main.o: in function `main':
          /home/ludo/Documents/Dev_C/QT/build-DeditecQuickCpp-Desktop_Qt_6_4_2_GCC_64bit-Debug/../DeditecQuickCpp/main.cpp:23: undefined reference to `DapiOpenModuleEx'
          collect2: error: ld returned 1 exit status
          make: *** [Makefile:211: DeditecQuickCpp] Error 1
          08:54:37: The process "/usr/bin/make" exited with code 2.
          Error while building/deploying project DeditecQuickCpp (kit: Desktop Qt 6.4.2 GCC 64bit)
          When executing step "Make"
          08:54:37: Elapsed time: 00:01.
          
          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #5

          @LudoFR
          What files are in /home/ludo/Documents/Dev_C/QT/DeditecQuickCpp/delib/lib/build_x64/? How were the libraries there built, and who built them?

          LudoFRL 1 Reply Last reply
          0
          • JonBJ JonB

            @LudoFR
            What files are in /home/ludo/Documents/Dev_C/QT/DeditecQuickCpp/delib/lib/build_x64/? How were the libraries there built, and who built them?

            LudoFRL Offline
            LudoFRL Offline
            LudoFR
            wrote on last edited by LudoFR
            #6

            @JonB

            Here the script for compiling the *.so library :

            #!/bin/bash
            
            flags="-Wall -Werror"
            lib_name=./build_x64/libDelibTcp
            
            list_of_source_files="
            blowfish.c
            deditec_encryption_utils.c
            delib_io_tcp_encryption.c
            -g"
             
            list_of_object_files="
            blowfish.o
            deditec_encryption_utils.o
            delib_io_tcp_encryption.o
            -g"
             
            echo now compiling $lib_name
            gcc -c $flags -fpic $list_of_source_files
            
            if [ $? != "0" ]
               then echo
                    echo "error(s) found while compiling"
                    exit 100
               else echo
                    gcc -shared -o $lib_name.so $list_of_object_files
            		rm *.o
            		echo "lib created"
            fi
            

            Following the documentation

            Here the files used for compilation.
            1fe55a9e-c0ac-49b1-9057-f1a51e63364e-image.png

            Sorry I'm kind of beginner with Linux and C++ globally (too much time on windows and C# sadly for me)

            JonBJ 1 Reply Last reply
            0
            • LudoFRL LudoFR

              @JonB

              Here the script for compiling the *.so library :

              #!/bin/bash
              
              flags="-Wall -Werror"
              lib_name=./build_x64/libDelibTcp
              
              list_of_source_files="
              blowfish.c
              deditec_encryption_utils.c
              delib_io_tcp_encryption.c
              -g"
               
              list_of_object_files="
              blowfish.o
              deditec_encryption_utils.o
              delib_io_tcp_encryption.o
              -g"
               
              echo now compiling $lib_name
              gcc -c $flags -fpic $list_of_source_files
              
              if [ $? != "0" ]
                 then echo
                      echo "error(s) found while compiling"
                      exit 100
                 else echo
                      gcc -shared -o $lib_name.so $list_of_object_files
              		rm *.o
              		echo "lib created"
              fi
              

              Following the documentation

              Here the files used for compilation.
              1fe55a9e-c0ac-49b1-9057-f1a51e63364e-image.png

              Sorry I'm kind of beginner with Linux and C++ globally (too much time on windows and C# sadly for me)

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #7

              @LudoFR
              These are the files in the lib directory. I asked to see the files in the lib/build_x64 subdirectory.

              LudoFRL 1 Reply Last reply
              0
              • JonBJ JonB

                @LudoFR
                These are the files in the lib directory. I asked to see the files in the lib/build_x64 subdirectory.

                LudoFRL Offline
                LudoFRL Offline
                LudoFR
                wrote on last edited by
                #8

                @JonB No files into this folder, its just the lib compilation ouput folder

                JonBJ 1 Reply Last reply
                0
                • LudoFRL LudoFR

                  @JonB No files into this folder, its just the lib compilation ouput folder

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #9

                  @LudoFR
                  Umm, if there are no files in that folder then there is no library to link against....!

                  Did you actually run the script to build the library?

                  lib_name=./build_x64/libDelibTcp

                  I am expecting to see that created at least build_x64/libDelibTcp.so.

                  LudoFRL 1 Reply Last reply
                  0
                  • JonBJ JonB

                    @LudoFR
                    Umm, if there are no files in that folder then there is no library to link against....!

                    Did you actually run the script to build the library?

                    lib_name=./build_x64/libDelibTcp

                    I am expecting to see that created at least build_x64/libDelibTcp.so.

                    LudoFRL Offline
                    LudoFRL Offline
                    LudoFR
                    wrote on last edited by LudoFR
                    #10

                    @JonB

                    Yes I run the script :

                    0_make_tcp_encryption_lib_x64.sh
                    

                    Sorry my fault, there is no files except the libDelibTcp.so

                    944f831d-98ef-42ed-a4da-8f104da909b6-image.png

                    Compilation output from QT look different, (I do not have change anything)

                    09:47:57: Running steps for project DeditecQuickCpp...
                    09:47:57: Configuration unchanged, skipping qmake step.
                    09:47:57: Starting: "/usr/bin/make" -j20
                    g++ -Wl,-rpath,/home/ludo/Qt/6.4.2/gcc_64/lib -Wl,-rpath-link,/home/ludo/Qt/6.4.2/gcc_64/lib -o DeditecQuickCpp  main.o qrc_qmake_resources.o   -L/home/ludo/Documents/Dev_C/QT/DeditecQuickCpp/delib/lib/build_x64/ -lDelibTcp /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Quick.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6OpenGL.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Gui.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6QmlModels.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Qml.so -pthread /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Network.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Core.so -lpthread -lGL   
                    /usr/bin/ld: main.o: in function `main':
                    /home/ludo/Documents/Dev_C/QT/build-DeditecQuickCpp-Desktop_Qt_6_4_2_GCC_64bit-Debug/../DeditecQuickCpp/main.cpp:23: undefined reference to `DapiOpenModuleEx'
                    collect2: error: ld returned 1 exit status
                    make: *** [Makefile:211: DeditecQuickCpp] Error 1
                    09:47:57: The process "/usr/bin/make" exited with code 2.
                    Error while building/deploying project DeditecQuickCpp (kit: Desktop Qt 6.4.2 GCC 64bit)
                    When executing step "Make"
                    09:47:57: Elapsed time: 00:00.
                    
                    
                    JonBJ 1 Reply Last reply
                    0
                    • LudoFRL LudoFR

                      @JonB

                      Yes I run the script :

                      0_make_tcp_encryption_lib_x64.sh
                      

                      Sorry my fault, there is no files except the libDelibTcp.so

                      944f831d-98ef-42ed-a4da-8f104da909b6-image.png

                      Compilation output from QT look different, (I do not have change anything)

                      09:47:57: Running steps for project DeditecQuickCpp...
                      09:47:57: Configuration unchanged, skipping qmake step.
                      09:47:57: Starting: "/usr/bin/make" -j20
                      g++ -Wl,-rpath,/home/ludo/Qt/6.4.2/gcc_64/lib -Wl,-rpath-link,/home/ludo/Qt/6.4.2/gcc_64/lib -o DeditecQuickCpp  main.o qrc_qmake_resources.o   -L/home/ludo/Documents/Dev_C/QT/DeditecQuickCpp/delib/lib/build_x64/ -lDelibTcp /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Quick.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6OpenGL.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Gui.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6QmlModels.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Qml.so -pthread /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Network.so /home/ludo/Qt/6.4.2/gcc_64/lib/libQt6Core.so -lpthread -lGL   
                      /usr/bin/ld: main.o: in function `main':
                      /home/ludo/Documents/Dev_C/QT/build-DeditecQuickCpp-Desktop_Qt_6_4_2_GCC_64bit-Debug/../DeditecQuickCpp/main.cpp:23: undefined reference to `DapiOpenModuleEx'
                      collect2: error: ld returned 1 exit status
                      make: *** [Makefile:211: DeditecQuickCpp] Error 1
                      09:47:57: The process "/usr/bin/make" exited with code 2.
                      Error while building/deploying project DeditecQuickCpp (kit: Desktop Qt 6.4.2 GCC 64bit)
                      When executing step "Make"
                      09:47:57: Elapsed time: 00:00.
                      
                      
                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #11

                      @LudoFR
                      Because I am a very nice guy [ ;-) ] I downloaded your "deditec" library stuff for Linux and set up a tiny project to use it. I get the same "undefined" on any Dapi... call as you do.

                      So then I went ran on lib/build_x64/libDelibTcp.so (I just used the one already compiled there)

                      nm --dynamic libDelibTcp.so
                      

                      This shows me all the symbols defined/exported in libDelibTcp.so. And there is nothing even vaguely like Dapi... anything there. Just some Blowfish... and dt_... functions.

                      So.... I don't know what you are supposed to be using (I'm not going to read the whole Delib documenation). But I can only conclude that including the delib.h stuff which declares Dapi... functions requires something very different from (at least the currently built) libDelibTcp.so content to link against....

                      The script name indicates to me that it is just for some encryption routines (0_make_tcp_encryption_lib_x64.sh). I think there is quite some other library you are supposed to be linking against for anything Dapi...??

                      In the delib directory I see all the delib_Dapi_... source files. I suspect that is what needs building? I see your DapiOpenModuleEx implementation is defined in file delib_open_close.cpp.

                      Maybe go look in the supplied samples directory? There I see e.g. 1_compile_usb_sample.sh. Looking in that I see a gcc command which explicitly compiles and links a whole bunch of the source files, including a couple of delib_Dapi... ones. Does this indicate how you are supposed to do it? So no library for those source files, rather you are supposed to compile them to .o files and link them against your code? Same for the "ethernet" sample, which includes a readme.txt, clarifying that libDelibTcp.so is only to do with encryption....

                      LudoFRL 1 Reply Last reply
                      1
                      • JonBJ JonB

                        @LudoFR
                        Because I am a very nice guy [ ;-) ] I downloaded your "deditec" library stuff for Linux and set up a tiny project to use it. I get the same "undefined" on any Dapi... call as you do.

                        So then I went ran on lib/build_x64/libDelibTcp.so (I just used the one already compiled there)

                        nm --dynamic libDelibTcp.so
                        

                        This shows me all the symbols defined/exported in libDelibTcp.so. And there is nothing even vaguely like Dapi... anything there. Just some Blowfish... and dt_... functions.

                        So.... I don't know what you are supposed to be using (I'm not going to read the whole Delib documenation). But I can only conclude that including the delib.h stuff which declares Dapi... functions requires something very different from (at least the currently built) libDelibTcp.so content to link against....

                        The script name indicates to me that it is just for some encryption routines (0_make_tcp_encryption_lib_x64.sh). I think there is quite some other library you are supposed to be linking against for anything Dapi...??

                        In the delib directory I see all the delib_Dapi_... source files. I suspect that is what needs building? I see your DapiOpenModuleEx implementation is defined in file delib_open_close.cpp.

                        Maybe go look in the supplied samples directory? There I see e.g. 1_compile_usb_sample.sh. Looking in that I see a gcc command which explicitly compiles and links a whole bunch of the source files, including a couple of delib_Dapi... ones. Does this indicate how you are supposed to do it? So no library for those source files, rather you are supposed to compile them to .o files and link them against your code? Same for the "ethernet" sample, which includes a readme.txt, clarifying that libDelibTcp.so is only to do with encryption....

                        LudoFRL Offline
                        LudoFRL Offline
                        LudoFR
                        wrote on last edited by
                        #12

                        @JonB Wow, really I want to thank you for your effort, this mean a lot seriously.

                        To be honest, this is why I think for the start because this lib is totally different from the one I use in C#.

                        So if I understand good I need to compile all files listed here :

                        #!/bin/bash
                        
                        bin_name=ethernet_sample
                        preprocessor_defines="-D USE_ETH"
                        
                        list_of_files="
                        source/ethernet_sample.c
                        
                        ../../delib-sources/delib/library/vc/deditec_timer.c
                        ../../delib-sources/delib/library/vc/deditec_tcp_io.c
                        ../../delib-sources/delib/library/vc/deditec_buff_utils.c
                        ../../delib-sources/delib/library/vc/deditec_string_utils.c
                        ../../delib-sources/delib/library/vc/deditec_convert_functions.c
                        ../../delib-sources/delib/library/embedded/deditec_debug_comfort.c
                        
                        ../../delib-sources/delib/delib_hdlmgr.c
                        ../../delib-sources/delib/delib_packet_statistic.c
                        ../../delib-sources/delib/delib_Dapi_di_do_ad_da_befehle.c
                        ../../delib-sources/delib/delib_set_get_error.c
                        ../../delib-sources/delib/delib_Dapi_register_commands.c
                        ../../delib-sources/delib/delib_open_close.c
                        ../../delib-sources/delib/delib_io_tcp.c
                        -g"
                        
                        echo now compiling $bin_name
                        gcc $preprocessor_defines -o $bin_name $list_of_files
                        
                        if [ $? != "0" ]
                           then echo
                                echo "error(s) found while compiling"
                                exit 100
                           else echo
                                echo "compiling successfull"
                        fi
                        

                        Into a *.o lib?

                        JonBJ 1 Reply Last reply
                        0
                        • LudoFRL LudoFR

                          @JonB Wow, really I want to thank you for your effort, this mean a lot seriously.

                          To be honest, this is why I think for the start because this lib is totally different from the one I use in C#.

                          So if I understand good I need to compile all files listed here :

                          #!/bin/bash
                          
                          bin_name=ethernet_sample
                          preprocessor_defines="-D USE_ETH"
                          
                          list_of_files="
                          source/ethernet_sample.c
                          
                          ../../delib-sources/delib/library/vc/deditec_timer.c
                          ../../delib-sources/delib/library/vc/deditec_tcp_io.c
                          ../../delib-sources/delib/library/vc/deditec_buff_utils.c
                          ../../delib-sources/delib/library/vc/deditec_string_utils.c
                          ../../delib-sources/delib/library/vc/deditec_convert_functions.c
                          ../../delib-sources/delib/library/embedded/deditec_debug_comfort.c
                          
                          ../../delib-sources/delib/delib_hdlmgr.c
                          ../../delib-sources/delib/delib_packet_statistic.c
                          ../../delib-sources/delib/delib_Dapi_di_do_ad_da_befehle.c
                          ../../delib-sources/delib/delib_set_get_error.c
                          ../../delib-sources/delib/delib_Dapi_register_commands.c
                          ../../delib-sources/delib/delib_open_close.c
                          ../../delib-sources/delib/delib_io_tcp.c
                          -g"
                          
                          echo now compiling $bin_name
                          gcc $preprocessor_defines -o $bin_name $list_of_files
                          
                          if [ $? != "0" ]
                             then echo
                                  echo "error(s) found while compiling"
                                  exit 100
                             else echo
                                  echo "compiling successfull"
                          fi
                          

                          Into a *.o lib?

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by JonB
                          #13

                          @LudoFR said in undefined reference - Help first time external header library QT C++ [Linux]:

                          Wow, really I want to thank you for your effort, this mean a lot seriously.

                          That's good, because I'm expecting a beer ;-)

                          Into a *.o lib?

                          No. Compiling each of those files separately will produce a .o file for each of the .c source files. This example does not show any library (.so, or for that matter .a) being generated from them. I presume that is how it is intended to work, author does not want you to create a single library but rather compile them all and link all the .o files.

                          Assuming this is so, then I believe you will have to add all whatever necessary .c files (may not be all the ones in this example, might be others, I don't know) into your Qt project as source files, in addition to your own source file(s). Then when you build the project all the .o files will be created separately, and all must be included in the link line.

                          I'm afraid it's over to you to do whatever to get all those source files correctly added into the project in Creator/the .pro file. You will have to be careful the paths are right and their header (.h) files are found correctly.

                          P.S.
                          At this point have you considered dropping this third-party Borland stuff completely and using Qt's QTcpSocket to do whatever you want from TCP instead? But I'm not offering to change your own source code over from using Borland TCP to Qt's ;-)

                          LudoFRL 1 Reply Last reply
                          0
                          • JonBJ JonB

                            @LudoFR said in undefined reference - Help first time external header library QT C++ [Linux]:

                            Wow, really I want to thank you for your effort, this mean a lot seriously.

                            That's good, because I'm expecting a beer ;-)

                            Into a *.o lib?

                            No. Compiling each of those files separately will produce a .o file for each of the .c source files. This example does not show any library (.so, or for that matter .a) being generated from them. I presume that is how it is intended to work, author does not want you to create a single library but rather compile them all and link all the .o files.

                            Assuming this is so, then I believe you will have to add all whatever necessary .c files (may not be all the ones in this example, might be others, I don't know) into your Qt project as source files, in addition to your own source file(s). Then when you build the project all the .o files will be created separately, and all must be included in the link line.

                            I'm afraid it's over to you to do whatever to get all those source files correctly added into the project in Creator/the .pro file. You will have to be careful the paths are right and their header (.h) files are found correctly.

                            P.S.
                            At this point have you considered dropping this third-party Borland stuff completely and using Qt's QTcpSocket to do whatever you want from TCP instead? But I'm not offering to change your own source code over from using Borland TCP to Qt's ;-)

                            LudoFRL Offline
                            LudoFRL Offline
                            LudoFR
                            wrote on last edited by
                            #14

                            @JonB

                            Well not against offering you a beer, or two...(or more :-))

                            @JonB said in undefined reference - Help first time external header library QT C++ [Linux]:

                            At this point have you considered dropping this third-party Borland stuff completely and using Qt's QTcpSocket to do whatever you want from TCP instead? But I'm not offering to change your own source code over from using Borland TCP to Qt's ;-)

                            This APi is used for GPIO manipulation from an ethernet GPIO modules :
                            787d599f-c9e0-4a81-b147-61a7492b4eee-image.png

                            What you say seems really true, cause the documentation about the use with Visual studio c++ do not refer at any moment about any library, only cpp/h files. I will try to use this documentation and use into my *.pro file only the files used into Visual Studio.

                            https://www.deditec.de/media/pdf/manual_e_delib.pdf#page=26&zoom=auto,-329,815

                            I will made you a feedback of course

                            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