:-1: error: symbol(s) not found for architecture x86_64 AND :-1: error: collect2: ld returned 1 exit status



  • I receive the following 2 errors:

    • :-1: error: symbol(s) not found for architecture x86_64
    • :-1: error: collect2: ld returned 1 exit status

    I am running on Mac OS 10.6.8 with QT creator 2.2.1.

    This is the following code:

    geomao.h:
    @#ifndef GEOMAP_H
    #define GEOMAP_H

    #include <QGeoMappingManager>
    #include <QGeoServiceProvider>
    #include <QGraphicsGeoMap>
    #include <QGeoCoordinate>
    #include <QGraphicsScene>
    #include <QGraphicsView>
    #include <QPointF>
    #include <QGraphicsSceneMouseEvent>

    QTM_USE_NAMESPACE

    class GeoMap : public QGraphicsGeoMap
    {
    Q_OBJECT

    private:
    QGraphicsGeoMap *map;
    QGeoCoordinate *coord;
    QGraphicsScene mapScene;
    QGraphicsView *mapView;
    bool panActive;

    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
    

    public:
    GeoMap(QGeoMappingManager *mappingManager, QGraphicsView *view);
    ~GeoMap();

    void setCoordinates(QGeoCoordinate *c);
    void displayMap(bool isVisible);
    
    QGraphicsView getMapView();
    QGeoCoordinate getCoordinates();
    

    signals:

    public slots:

    };

    #endif // GEOMAP_H
    @

    geomap.cpp
    @#include "geomap.h"

    GeoMap::GeoMap(QGeoMappingManager *mappingManager, QGraphicsView *view) : QGraphicsGeoMap(mappingManager)
    {
    // QGeoMappingManager *mappingManager = 0;
    // QGeoServiceProvider serviceProvider("nokia");
    // mappingManager = serviceProvider.mappingManager();
    this->map = new QGraphicsGeoMap(mappingManager);

    this->map->resize(350, 480);
    this->map->setPos(1, 1);
    this->map->setCenter(*coord);
    this->map->setZoomLevel(15);
    
    QGraphicsScene scene;
    scene.addItem(this->map);
    
    this->mapView = view;
    this->mapView->setScene(&scene);
    this->mapView->setInteractive(true);
    

    }

    void GeoMap::setCoordinates(QGeoCoordinate *c)
    {
    this->coord = c;
    this->map->setCenter(*c);
    }

    void GeoMap::displayMap(bool isVisible)
    {
    if (isVisible) {
    this->mapView->show();
    }
    else {
    this->mapView->hide();
    }
    }

    QGeoCoordinate GeoMap::getCoordinates()
    {
    return *this->coord;
    }

    void GeoMap::mousePressEvent(QGraphicsSceneMouseEvent *event)
    {
    this->panActive = true;
    event->accept();
    }

    void GeoMap::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
    {
    this->panActive = false;
    event->accept();
    }

    void GeoMap::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
    {
    if (this->panActive) {
    QPointF delta = event->lastPos() - event->pos();
    pan(delta.x(), delta.y());
    }
    event->accept();
    }
    @

    and the main.cpp:
    @#include "mainwindow.h"

    #include <QtGui/QApplication>

    #include <QGeoMappingManager>
    #include <QGeoServiceProvider>
    #include <QGraphicsGeoMap>
    #include <QDebug>
    #include <QGraphicsScene>
    #include <QGraphicsView>
    #include <QGeoCoordinate>
    #include <QGeoMapCircleObject>
    #include <geomap.h>

    QTM_USE_NAMESPACE

    //class GeoMap;

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);

    // MainWindow mainWindow;
    // mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
    // mainWindow.showExpanded();

    // QPushButton helloButton("Hello World");
    // helloButton.resize(80, 20);
    // helloButton.show();

    /*
    QGeoMappingManager *mappingManager = 0;
    // QGeoRoutingManager *routingManager = 0;
    // QGeoSearchManager *searchManager = 0;

        QGeoServiceProvider serviceProvider("nokia");
        mappingManager = serviceProvider.mappingManager();
        QGraphicsGeoMap *map = new QGraphicsGeoMap(mappingManager);
        map->resize(350, 480);
        map->setPos(1, 1);
        map->setZoomLevel(13);
    
        const QGeoCoordinate *q = new QGeoCoordinate(45.783008, 24.148178);
        map->setCenter(*q);
    

    // QGeoMapCircleObject *circ = new QGeoMapCircleObject(*q, 50000);
    // circ->setVisible(true);
    // map->addMapObject(circ);

        QGraphicsScene scene;
        scene.addItem(map);
    
        QGraphicsView view(&scene);
        view.setInteractive(true);
        view.setVisible(true);
        view.show();
    

    */

    QGeoMappingManager *mappingManager = 0;
    QGeoServiceProvider serviceProvider("nokia");
    mappingManager = serviceProvider.mappingManager();
    QGraphicsView *mapView;
    

    // QGraphicsItem *gItem;

    GeoMap *testObj = new GeoMap(mappingManager, mapView);
    testObj->displayMap(true);
    
    return app.exec();
    

    }
    @

    When viewing the compile output, it shows written in red:
    @
    Undefined symbols for architecture x86_64:
    "GeoMap::~GeoMap()", referenced from:
    vtable for GeoMapin moc_geomap.o
    "GeoMap::~GeoMap()", referenced from:
    vtable for GeoMapin moc_geomap.o
    "non-virtual thunk to GeoMap::~GeoMap()", referenced from:
    vtable for GeoMapin moc_geomap.o
    "non-virtual thunk to GeoMap::~GeoMap()", referenced from:
    vtable for GeoMapin moc_geomap.o
    "non-virtual thunk to GeoMap::~GeoMap()", referenced from:
    vtable for GeoMapin moc_geomap.o
    "non-virtual thunk to GeoMap::~GeoMap()", referenced from:
    vtable for GeoMapin moc_geomap.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    make: *** [Maps02.app/Contents/MacOS/Maps02] Error 1
    make: Leaving directory `/Users/andreibechet/Work/Nokia Project/Qt/Testing/Maps02-build-simulator'
    The process "/usr/bin/make" exited with code 2.
    Error while building project Maps02 (target: Qt Simulator)
    When executing build step 'Make'
    @



  • Looks like you have declared a GeoMap destructor, but not defined it.



  • I have defined the constructor and the errors disappear, but then I encounter another problem: the application quits unexpectedly (I am presented with the usual pop-up window form Mac OS where I am given some info and the option to reopen).

    @GeoMap::~GeoMap()
    {
    delete map;
    delete coord;
    delete mapScene;
    delete mapView;
    }@



  • From what I can tell, form debugger mode, the problem seems to happen on this line

    @ this->mapView->setScene(scene);
    @



  • I have done some small modifications in the constructor:

    @GeoMap::GeoMap(QGeoMappingManager *mappingManager, QGraphicsView *view) : QGraphicsGeoMap(mappingManager)
    {
    this->coord = new QGeoCoordinate(45.783008, 24.148178);

    // QGeoMappingManager *mappingManager = 0;
    // QGeoServiceProvider serviceProvider("nokia");
    // mappingManager = serviceProvider.mappingManager();
    this->map = new QGraphicsGeoMap(mappingManager);

    this->map->resize(350, 480);
    this->map->setPos(1, 1);
    this->map->setCenter(*coord);
    this->map->setZoomLevel(15);
    
    QGraphicsScene *scene = new QGraphicsScene;
    scene->addItem(this->map);
    

    // this->mapScene->addItem(this->map);

    this->mapView = view;
    this->mapView->setScene(scene);
    

    // this->mapView->setInteractive(true);
    }@



  • Looks like you are not creating your graphics view.



  • Yeah ... I figured that could be the problem ... but I don't understand why?
    When I move this pard in the main it works like a charm.
    I even tried this:

    @GeoMap::GeoMap(QGeoMappingManager *mappingManager, QGraphicsView *view) : QGraphicsGeoMap(mappingManager)
    {
    this->coord = new QGeoCoordinate(45.783008, 24.148178);

    // QGeoMappingManager *mappingManager = 0;
    // QGeoServiceProvider serviceProvider("nokia");
    // mappingManager = serviceProvider.mappingManager();
    this->map = new QGraphicsGeoMap(mappingManager);

    this->map->resize(350, 480);
    this->map->setPos(1, 1);
    this->map->setCenter(*coord);
    this->map->setZoomLevel(15);
    
    QGraphicsScene scene;
    scene.addItem(this->map);
    

    // this->mapScene->addItem(this->map);

    QGraphicsView vview(&scene);
    vview.setInteractive(true);
    vview.setVisible(true);
    

    // vview.show();
    this->mapView = &vview;
    this->mapView->show();

    // this->mapView = view;
    // this->mapView->setScene(scene);
    // this->mapView->setVisible(true);
    // this->mapView->setInteractive(true);
    }
    @



  • Well, here you are creating a graphics view: @QGraphicsView vview(&scene);@
    Before you didn't create one: @QGraphicsView *mapView;@
    Just a pointer to one, which points to something arbitrary because you don't set its value.



  • Hi,
    I am also facing the same problem on Same operating system.
    I include the taglib with my project on windows and it is working fine on windows.
    but when i try to run this on mac it give me the same error.
    I add code in project.pro file:

    @
    INCLUDPATH +="taglib-1.6.3/include"
    LIBS +="taglib-1.6.3/libtaglib.a"
    LIBS +=taglib-1.6.3/taglib.dll
    @

    I already added libtaglib.a and taglib.dll in my project along with taglib source code.

    I added code on Main:

    @
    #include "tag.h"
    #include "fileref.h"
    #include "taglib.h"
    #include "taglib_export.h"

    Q_DECL_EXPORT int main(int argc,char *argv[])
    {
    TagLib::FileName filepath("song.mp3");
    TagLib::FileRef f(filepath);
    TagLib::String artist=f.tag()->artist();
    aDebug()<<"Artist="<< artist.toCString();
    }
    @

    This code is working for windows but not for OSX.

    [EDIT: code formatting, please wrap in @-tags]



  • you cannot use a .dll on a Mac. DLLs are Windows only.

    Also, make sure to have the correct architectures for your executable. The Mac support so called universal binaries, that is code for multiple architectures (intel/ppc, 32/64 bit) in on big "fat" file.

    Seems like your library is not built with x86_64 architecture.



  • I compiled Taglib for Mac using cmake under this conditions
    CMAKE_BUILD_TYPE=Release
    CMAKE_OSX_ARCHITECTURE=x86_64
    CMAKE_OSX_DEPLOYMENT_TARGET=10.6

    I added in project.pro file
    LIBS += taglib-1.6.3/taglib/libtag.1.6.3.dylib

    When i build this project it crash on start and give me following error.

    Process: Project [2697]
    Path: /30July/Project-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Release/Project.app/Contents/MacOS/Project
    Identifier: com.yourcompany.Project
    Version: ??? (???)
    Code Type: X86-64 (Native)
    Parent Process: Qt Creator [1388]

    Date/Time: 2012-07-29 10:26:07.262 +0530
    OS Version: Mac OS X 10.6.8 (10K549)
    Report Version: 6

    Interval Since Last Report: 431809 sec
    Crashes Since Last Report: 87
    Per-App Interval Since Last Report: 6045 sec
    Per-App Crashes Since Last Report: 87
    Anonymous UUID: 9B4C4495-E766-4E88-A3AC-F75CA5B720D1

    Exception Type: EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
    Crashed Thread: 0 Dispatch queue: com.apple.main-thread

    Thread 0 Crashed: Dispatch queue: com.apple.main-thread
    0 com.yourcompany.Project 0x0000000100007f9e searchfile(QDir) + 1774
    1 com.yourcompany.Project 0x0000000100008c99 track_data::track_get_data() + 89
    2 com.yourcompany.Project 0x000000010000430d main + 237
    3 com.yourcompany.Project 0x00000001000041f8 start + 52

    Thread 1: Dispatch queue: com.apple.libdispatch-manager
    0 libSystem.B.dylib 0x00007fff824fcc0a kevent + 10
    1 libSystem.B.dylib 0x00007fff824feadd _dispatch_mgr_invoke + 154
    2 libSystem.B.dylib 0x00007fff824fe7b4 _dispatch_queue_invoke + 185
    3 libSystem.B.dylib 0x00007fff824fe2de _dispatch_worker_thread2 + 252
    4 libSystem.B.dylib 0x00007fff824fdc08 _pthread_wqthread + 353
    5 libSystem.B.dylib 0x00007fff824fdaa5 start_wqthread + 13

    Thread 2:
    0 libSystem.B.dylib 0x00007fff824fda2a __workq_kernreturn + 10
    1 libSystem.B.dylib 0x00007fff824fde3c _pthread_wqthread + 917
    2 libSystem.B.dylib 0x00007fff824fdaa5 start_wqthread + 13

    Thread 3:
    0 libSystem.B.dylib 0x00007fff8251ea6a __semwait_signal + 10
    1 libSystem.B.dylib 0x00007fff82522881 _pthread_cond_wait + 1286
    2 QtScript 0x000000010079a176 QTWTF::TCMalloc_PageHeap::scavengerThread() + 118
    3 QtScript 0x000000010079a1b9 QTWTF::TCMalloc_PageHeap::runScavengerThread(void*) + 9
    4 libSystem.B.dylib 0x00007fff8251cfd6 _pthread_start + 331
    5 libSystem.B.dylib 0x00007fff8251ce89 thread_start + 13

    Thread 0 crashed with X86 Thread State (64-bit):
    rax: 0x0000000000000000 rbx: 0x0000000102392a78 rcx: 0x0000000000000010 rdx: 0x00007fff703d0650
    rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x00007fff5fbff6a0 rsp: 0x00007fff5fbff2d0
    r8: 0x0000000000008000 r9: 0x0000000010238ecf r10: 0x0000000000000001 r11: 0x0000000000000001
    r12: 0x00007fff5fbff560 r13: 0x00007fff5fbff5e0 r14: 0x0000000000000000 r15: 0x00007fff5fbff480
    rip: 0x0000000100007f9e rfl: 0x0000000000010206 cr2: 0x0000000000000000

    Binary Images:
    0x100000000 - 0x100084fef +com.yourcompany.Project ??? (???) <5C64C9F1-D7DD-21A1-3301-BA63561C6E42> /30July/Project-build-desktop-Desktop_Qt_4_8_1_for_GCC__Qt_SDK__Release/Project.app/Contents/MacOS/Project
    0x100090000 - 0x10010cff7 +libtag.1.dylib 1.6.3 (compatibility 1.0.0) <39492430-1D41-9E2F-AA41-8A0DB805CB24> /Users/ngtech/Desktop/taglibDy13/taglib/libtag.1.dylib
    0x100142000 - 0x1004cefef +QtDeclarative 4.8.1 (compatibility 4.8.0) <4FB02A99-E073-84C2-F627-404945573DFD> /Users/ngtech/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtDeclarative.framework/Versions/4/QtDeclarative
    0x100642000 - 0x100899fff +QtScript 4.8.1 (compatibility 4.8.0) <088A5B4A-34E6-1760-5198-2725F84D0B88> /Users/ngtech/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtScript.framework/Versions/4/QtScript
    0x100954000 - 0x100c20fff +QtCore 4.8.1 (compatibility 4.8.0) <6B9A68BA-E0D1-DCBB-F398-85C71CEEB8CA> /Users/ngtech/QtSDK/Desktop/Qt/4.8.1/gcc/lib/QtCore.framework/Versions/4/QtCore



  • Thank you Volker with the help of your post i am able to solve this problem.



  • Hi,
    I face some other problem with TagLib.
    I compiled Taglib for Mac 10.6 using cmake under this conditions
    CMAKE_BUILD_TYPE=Release
    CMAKE_OSX_ARCHITECTURE=x86_64
    CMAKE_OSX_DEPLOYMENT_TARGET=10.6
    as in image
    "Click Here for image":https://docs.google.com/document/d/1Hu_SGJuXSCANEZ4IsuhQP4VzLx6EonTgLWlkXgr4lP8/edit

    Target folder : user/ngtech/desktop/taglibDy13
    This is working fine on the source machine. But when i move the code on other MAC machine with same environment , i faced a error when i remove taglibDy13 folder from desktop.
    library not loaded : /user/ngtech/desktop/taglibDy13/taglib/libtag.1.dylib.
    I already copied required .dylib files in my project
    @INCLUDEPATH +="taglib-1.6.3/include"
    LIBS += "taglib-1.6.3/libtag.1.6.3.dylib"@

    Can any one tell me how can i make this distributed library so that i can run my project on other computers.


Log in to reply
 

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