Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

DeclarativeSurface - undefined reference



  • I am building an application that utilizes the undocumented DeclarativeSurface class, but having link problems. DeclarativeSurface is defined in 5.14.2/Src/qtdatavis3d/src/datavisualizationqml2/declarativesurface_p.h. I see DeclarativeSurface code in library qml/QtDataVisualization/libdatavisualizationqml2.so, e.g. with the Linux 'nm' command I see the constructor in that library:

    0000000000027c70 t QtDataVisualization::DeclarativeSurface::DeclarativeSurface(QQuickItem*)
    
    

    Here is a simple test program dvtest.cc:

    #include "datavisualizationqml2/declarativesurface_p.h"
    
    int main(int argc, char **argv) {
      QtDataVisualization::DeclarativeSurface *surface =
        new QtDataVisualization::DeclarativeSurface(nullptr);
    
      return 0;
    }
    

    However when I link the test I get "undefined reference" to the DeclarativeSurface constructor:

    g++ -o dvtest -I ~/Qt5.14.2/5.14.2/Src/qtdatavis3d/src -I ~/Qt/5.14.2/Src/qtdatavis3d/include/QtDataVisualization/5.14.2//QtDataVisualization/private/ -I ~/Qt/5.14.2/Src/qtbase/include/ -I ~/Qt/5.14.2/gcc_64/include  -I ~/Qt/5.14.2/gcc_64/include/QtDataVisualization/ -fPIC dvtest.cc ~/Qt/5.14.2/gcc_64/qml/QtDataVisualization/libdatavisualizationqml2.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Quick.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5DataVisualization.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Gui.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5QmlModels.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Qml.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Network.so /home/oreilly/Qt/5.14.2/gcc_64/lib/libQt5Core.so 
    /tmp/cc5SCIgN.o: In function `main':
    dvtest.cc:(.text+0x28): undefined reference to `QtDataVisualization::DeclarativeSurface::DeclarativeSurface(QQuickItem*)'
    collect2: error: ld returned 1 exit status
    

    Anyone know why this is?
    Thanks!



  • The 'nm' man page indicates that a lower case 't' indicates a function that's "local" to the library - all of the DeclarativeSurface symbols in that library are marked with 't'. How can I find accessible global functions (that I can use) invoke DeclarativeSurface methods?


Log in to reply