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. Undefined reference to `qBadAlloc()' all over the place
Forum Updated to NodeBB v4.3 + New Features

Undefined reference to `qBadAlloc()' all over the place

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 6.7k 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.
  • J Offline
    J Offline
    jbcolmena
    wrote on last edited by
    #1

    Hi all.

    I made an application at home, compiled it, and works nicely. Now it's in a server. When I run make I get a lot of @undefined reference to `qBadAlloc()'@, from different files and fuctions... using xubuntu, just installed qt using apt-get, and well, it just doesn't compile. qmake runs fine. This is the output of make. What library am I missing? what didn't I install? have no idea...

    bq. jbcolme@mybox:~/dg/dg0.2$ make
    g++ -Wl,-O1 -o bin/dg0 main.o newProject.o seg2build.o velocity.o plot.o invertDialog.o blockWindow.o splines.o moc_newProject.o moc_velocity.o moc_plot.o moc_invertDialog.o moc_blockWindow.o -L/usr/lib -L/usr/local/qwt-5.2.0/lib/ -lqwt -lQtGui -lQtCore -lpthread
    newProject.o: In function QVector<QString>::realloc(int, int)': /opt/qtsdk-2009.05/qt/include/QtCore/qvector.h:468: undefined reference to qBadAlloc()'
    /opt/qtsdk-2009.05/qt/include/QtCore/qvector.h:478: undefined reference to QVectorData::reallocate(QVectorData*, int, int, int)' /opt/qtsdk-2009.05/qt/include/QtCore/qvector.h:479: undefined reference to qBadAlloc()'
    newProject.o: In function QVectorTypedData<QString>::free(QVectorTypedData<QString>*, int)': /opt/qtsdk-2009.05/qt/include/QtCore/qvector.h:96: undefined reference to QVectorData::free(QVectorData*, int)'
    newProject.o: In function QVector<QString>::malloc(int)': /opt/qtsdk-2009.05/qt/include/QtCore/qvector.h:391: undefined reference to QVectorData::allocate(int, int)'
    /opt/qtsdk-2009.05/qt/include/QtCore/qvector.h:392: undefined reference to qBadAlloc()' velocity.o: In function QList<QString>::detach_helper()':
    velocity.cpp:(.text._ZN5QListI7QStringE13detach_helperEv[QList<QString>::detach_helper()]+0x1d): undefined reference to QListData::detach3()' velocity.o: In function QVector<double>::realloc(int, int)':
    velocity.cpp:(.text._ZN7QVectorIdE7reallocEii[QVector<double>::realloc(int, int)]+0x82): undefined reference to qBadAlloc()' velocity.cpp:(.text._ZN7QVectorIdE7reallocEii[QVector<double>::realloc(int, int)]+0x13d): undefined reference to QVectorData::reallocate(QVectorData*, int, int, int)'
    velocity.cpp:(.text._ZN7QVectorIdE7reallocEii[QVector<double>::realloc(int, int)]+0x14b): undefined reference to qBadAlloc()' velocity.o: In function QVector<double>::malloc(int)':
    velocity.cpp:(.text._ZN7QVectorIdE6mallocEi[QVector<double>::malloc(int)]+0x35): undefined reference to QVectorData::allocate(int, int)' velocity.cpp:(.text._ZN7QVectorIdE6mallocEi[QVector<double>::malloc(int)]+0x43): undefined reference to qBadAlloc()'
    velocity.o: In function QVectorTypedData<double>::free(QVectorTypedData<double>*, int)': velocity.cpp:(.text._ZN16QVectorTypedDataIdE4freeEPS0_i[QVectorTypedData<double>::free(QVectorTypedData<double>*, int)]+0x14): undefined reference to QVectorData::free(QVectorData*, int)'
    plot.o: In function QVector<QPointF>::malloc(int)': plot.cpp:(.text._ZN7QVectorI7QPointFE6mallocEi[QVector<QPointF>::malloc(int)]+0x35): undefined reference to QVectorData::allocate(int, int)'
    plot.cpp:(.text._ZN7QVectorI7QPointFE6mallocEi[QVector<QPointF>::malloc(int)]+0x43): undefined reference to qBadAlloc()' plot.o: In function QVectorTypedData<QPointF>::free(QVectorTypedData<QPointF>, int)':
    plot.cpp:(.text._ZN16QVectorTypedDataI7QPointFE4freeEPS1_i[QVectorTypedData<QPointF>::free(QVectorTypedData<QPointF>
    , int)]+0x14): undefined reference to QVectorData::free(QVectorData*, int)' plot.o: In function QVector<QPointF>::realloc(int, int)':
    plot.cpp:(.text._ZN7QVectorI7QPointFE7reallocEii[QVector<QPointF>::realloc(int, int)]+0x11a): undefined reference to qBadAlloc()' plot.cpp:(.text._ZN7QVectorI7QPointFE7reallocEii[QVector<QPointF>::realloc(int, int)]+0x18a): undefined reference to QVectorData::reallocate(QVectorData*, int, int, int)'
    plot.cpp:(.text._ZN7QVectorI7QPointFE7reallocEii[QVector<QPointF>::realloc(int, int)]+0x198): undefined reference to `qBadAlloc()'
    collect2: ld returned 1 exit status
    make: *** [bin/dg0] Error 1

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jbcolmena
      wrote on last edited by
      #2

      @qmake distclean@

      everything works now. Quite obvious, but well, this is my first qt app.

      Cheers.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        harryF
        wrote on last edited by
        #3

        bq. qmake distclean

        Just for the reference - that should be "make distclean"

        You compiled your application against a Qt version that was built with exception support, but then try to partially link it again against a Qt version without exception support.

        When you switch Qt versions like that, you should always run "make clean" to do a clean build.

        // happy hacking

        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