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

Symbol(s) not found for architecture x86_64



  • Hi,

    first of all I'd like to say that I know that there's already a thread open on that topic in which I posted as well. But since I didn't get any reply until now and as it's quite urgent I try my luck opening up a new topic on the same problem.
    I’m using Qt 4.7.3 on my Mac (OS X.6.7).
    I tried to run my project from Qt Creator and from eclipse but I keep getting the above mentioned error message.

    Background: I need to implement a few functionalities into a given framework that wasn’t created by myself.
    As the framework is quite large, I think it’s not useful to post it here. And as the above mentioned problem could be solved by modifying the pro-file I think that’s where my problem might be as well.

    So here’s my pro-file:
    @#-------------------------------------------------

    Project created by QtCreator 2011-06-17T13:45:15

    #-------------------------------------------------

    QT += core gui

    TARGET = Ueb03
    TEMPLATE = app
    DEPENDPATH += . src
    INCLUDEPATH += . src
    CONFIG -= app_bundle
    CONFIG += x86_64
    CONFIG -= i386
    LIBS += -lssl -lcrypto

    HEADERS += src/Geometry.h
    src/MainWindow.h
    src/Model.h
    src/MovingBox.h
    src/RollingBall.h
    src/RotatingCow.h
    src/RotationWidget.h
    SOURCES += src/Geometry.cpp
    src/main.cpp
    src/MainWindow.cpp
    src/Model.cpp
    src/MovingBox.cpp
    src/RollingBall.cpp
    src/RotatingCow.cpp
    src/RotationWidget.cpp@

    I made a few modifications according to the sampe pro file posted in this thread:
    "http://developer.qt.nokia.com/forums/viewthread/5665/":http://developer.qt.nokia.com/forums/viewthread/5665/

    Yet I get this error message:
    error: symbol(s) not found for architecture x86_64

    If you need any further information, please let me know.

    Thanks a lot in advance.



  • I do not have a solution however I am having a similar problem, I made a post here http://developer.qt.nokia.com/forums/viewthread/7168/ however I probably should have put it in this tools group as you did.

    A suggestion is to try:

    lipo -info yourlib.a
    and make sure it is also x86_64

    and the second is to see if the symbols not found are mentioned in the lib, try:

    nm yourlib.a | grep the_symbol_without_args

    You can see my post for an example.

    If both of those pass the test then you are at the same point I am. With any luck we can solve this and move on to actual development. :)

    -=ben



  • As a follow up, where are libssl and libcrypto coming from?

    -=ben



  • The linker will tell you which symbol is missing. That will help you to find out what differs.



  • Please show the complete output of the linker. You will find it in Qt Creator on the compiler output tab.



  • Hello,
    I'm prompted with the same kind of errors :
    @:-1: error: symbol(s) not found for architecture x86_64@
    @:-1: error: collect2: ld returned 1 exit status@

    Here is the code:
    @#ifndef GEOMAP_H
    #define GEOMAP_H

    //#include "mapswidget.h"

    #include <QGraphicsGeoMap>

    QTM_USE_NAMESPACE

    class MapsWidget;
    class GeoMap : public QGraphicsGeoMap
    {
    Q_OBJECT

    public:
    GeoMap(QGeoMappingManager*, MapsWidget*);
    ~GeoMap();

    private:
    MapsWidget *mapsWidget;

    };

    #endif // GEOMAP_H
    @

    @#ifndef MAPSWIDGET_H
    #define MAPSWIDGET_H

    #include "mapswidgetprivate.h"

    #include <QWidget>
    #include <QGeoMappingManager>

    QTM_USE_NAMESPACE

    //class MapsWidgetPrivate;
    class MapsWidget : public QWidget
    {
    Q_OBJECT

    public:
    MapsWidget(QWidget *parent = 0);
    ~MapsWidget();

    public slots:
    void initialize(QGeoMappingManager *manager);

    private:
    MapsWidgetPrivate *d;

    };

    #endif // MAPSWIDGET_H
    @

    @#ifndef MAPSWIDGETPRIVATE_H
    #define MAPSWIDGETPRIVATE_H

    #include "geomap.h"

    #include <QGraphicsView>
    #include <QGraphicsScene>
    #include <QGeoCoordinate>
    #include <QGeoMappingManager>

    QTM_USE_NAMESPACE

    class MapsWidgetPrivate
    {
    public:
    GeoMap *map;
    QGraphicsView *view;

    MapsWidgetPrivate();
    

    };

    #endif // MAPSWIDGETPRIVATE_H
    @

    @#include "geomap.h"

    GeoMap::GeoMap(QGeoMappingManager *manager, MapsWidget *mapsWidget) :
    QGraphicsGeoMap(manager), mapsWidget(mapsWidget)
    {
    }
    @

    @#include "mapswidget.h"

    #include <QtGui/QApplication>
    #include <QGeoServiceProvider>

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

    MapsWidget w;
    w.show();
    
    QGeoServiceProvider *serviceProvider = new QGeoServiceProvider("nokia");
    
    w.initialize(serviceProvider->mappingManager());
    
    
    return app.exec();
    

    }
    @

    @#include "mapswidget.h"

    MapsWidget::MapsWidget(QWidget *parent) :
    QWidget(parent)
    {
    }
    @

    @#include "mapswidgetprivate.h"
    #include "mapswidget.h"

    void MapsWidget::initialize(QGeoMappingManager *manager)
    {
    d->map = new GeoMap(manager, this);

     QGraphicsScene *sc = new QGraphicsScene;
     sc->addItem(d->map);
    
     d->map->resize(350, 480);
    
     d->view = new QGraphicsView(sc, this);
     d->view->setVisible(true);
     d->view->setInteractive(true);
    
     d->map->setCenter(QGeoCoordinate(45.783008, 24.148178));
     d->map->setZoomLevel(15);
    

    }
    @

    @# Add files and directories to ship with the application

    by adapting the examples below.

    file1.source = myfile

    dir1.source = mydir

    DEPLOYMENTFOLDERS = # file1 dir1

    symbian:TARGET.UID3 = 0xEDF1E0C2

    Smart Installer package's UID

    This UID is from the protected range

    and therefore the package will fail to install if self-signed

    By default qmake uses the unprotected range value if unprotected UID is defined for the application

    and 0x2002CCCF value if protected UID is given to the application

    #symbian:DEPLOYMENT.installer_header = 0x2002CCCF

    Allow network access on Symbian

    symbian:TARGET.CAPABILITY += NetworkServices

    If your application uses the Qt Mobility libraries, uncomment

    the following lines and add the respective components to the

    MOBILITY variable.

    CONFIG += mobility
    MOBILITY += location

    CONFIG += x86_64
    CONFIG -= i386
    LIBS += -lssl -lcrypto
    SOURCES += main.cpp
    mapswidget.cpp
    mapswidgetprivate.cpp
    geomap.cpp
    HEADERS +=
    mapswidget.h
    mapswidgetprivate.h
    geomap.h
    FORMS += mainwindow.ui

    Please do not modify the following two lines. Required for deployment.

    include(deployment.pri)
    qtcAddDeployment()
    @



  • The linker usually shows you which symbol(s) is/are missing. There should be more output from the error message.

    It's hard to tell what's going wrong, but as a blind guess, I suspect the mobility API to be not built correctly.



  • I forgot to mention that I use mac os 10.6.8 with qt creator 2.2.1.
    These are the only errors that are shown



  • To be mentioned that when simply trying to display a map in main it works like a charm

    @ 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();
    

    @



  • Maybe the compilation output can give you a better understanding of what is going on ..

    @Running build steps for project Maps03...
    Configuration unchanged, skipping qmake step.
    Starting: "/usr/bin/make" -w
    make: Entering directory /Users/andreibechet/Work/Nokia Project/Qt/Testing/Maps03-build-simulator' g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -o Maps03.app/Contents/MacOS/Maps03 main.o mapswidget.o mapswidgetprivate.o geomap.o moc_mapswidget.o moc_geomap.o -F/Users/andreibechet/QtSDK/Simulator/Qt/gcc/lib -L/Users/andreibechet/QtSDK/Simulator/Qt/gcc/lib -lssl -lcrypto -F/Users/andreibechet/QtSDK/Simulator/QtMobility/gcc/Library/Frameworks -L/Users/andreibechet/QtSDK/Simulator/QtMobility/gcc/Library/Frameworks -framework QtMobilitySimulator -framework QtLocation -framework QtGui -framework QtCore Undefined symbols for architecture x86_64: "MapsWidget::~MapsWidget()", referenced from: _main in main.o vtable for MapsWidgetin moc_mapswidget.o make: Leaving directory/Users/andreibechet/Work/Nokia Project/Qt/Testing/Maps03-build-simulator'
    "MapsWidget::~MapsWidget()", referenced from:
    vtable for MapsWidgetin moc_mapswidget.o
    "non-virtual thunk to MapsWidget::~MapsWidget()", referenced from:
    vtable for MapsWidgetin moc_mapswidget.o
    "non-virtual thunk to MapsWidget::~MapsWidget()", referenced from:
    vtable for MapsWidgetin moc_mapswidget.o
    "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: *** [Maps03.app/Contents/MacOS/Maps03] Error 1
    The process "/usr/bin/make" exited with code 2.
    Error while building project Maps03 (target: Qt Simulator)
    When executing build step 'Make'@



  • Looks to me that you need to recompile the mobility API stuff with the correct architecture settings (just another guess, though)



  • I abandoned the project .... it was very weird .... the error was probably generated by some sort of cyclic dependency. Now, that I have put all those things into 1 header and 1 cpp file and now it works. Actually I took the example which can be found in the Qt Creator.
    Thank you for all the help.


Log in to reply