QVector3D not working in 5.0.1



  • I reinstalled Qt from the latest download as I had a problem on my PC. Now my code will not compile properly. QVector3D does not seem to be working as it was before. (I am on Ubuntu OS)

    ...
    #include <QtGui/QVector3D>
    ...

    ...
    QVector3D P13D;
    ...

    ...
    P13D = QVector3D(Ax,Ay,Az);
    ...

    ...
    P13D.normalize(); ---> COMPILE FAILS HERE WITH " .... error: undefined reference to `QVector3D::normalize()' ...."
    ...

    ???



  • That is a linker, not compiler, error message. Possibly your PRO file needs gui in the QT variable.

    This compiles and link just fine on my Linux boxen:
    main.pro
    @
    TEMPLATE = app
    TARGET = main
    INCLUDEPATH += .
    SOURCES += main.cpp
    message(QT: $$QT)
    @
    main.cpp
    @
    #include <QCoreApplication>
    #include <QVector3D>
    int main(int argc, char **argv)
    {
    QCoreApplication app(argc, argv);
    static const float Ax = 5.0;
    static const float Ay = 5.0;
    static const float Az = 5.0;
    QVector3D P13D;
    P13D = QVector3D(Ax,Ay,Az);
    return 0;
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.