macosqtcompilationqt5

Qt5 "symbol(s) not found for architecture x86_64"


First of all, I know there are also others posts talking about this bug but mine is a bit different I think.

I've got a Qt project with this pro file :

QT       += core
QT       += network
QT       -= gui

TARGET = QDownloaderCLI

CONFIG   += console
CONFIG   -= app_bundle


TEMPLATE ...

I tried with CONFIG -= X86_64 but nothing change.

Searching on the web I discover something strange, I've got a .h file with a public slot with his implementation in a .cpp file :

public slots:
    void stateChanged(int state);

With this I've got the error message but if I comment void stateChanged(int state); in .h and .cpp it works.

How do I fix this ?

I also have warnings :

directory not found for option '-F/Applications/Qt//5.1.0/clang_64/qtbase/lib'

and

"This version of OS X is unsupported" [-W#warnings]

I also tried "Run qMake" but I've got warnings too :

No .qmake.cache is present. This significantly slows down qmake with this makespec.
Call 'cache()' in the top-level project file to rectify this problem.

I'm on Mac OS X 10.8.4 with Qt 5.1.0

Code of my .h file :

#ifndef DOWNLOADER_H
#define DOWNLOADER_H

#include <QObject>
#include <QDebug>
#include <QFile>
// In Qt 5 no more QHttp
#include <QNetworkAccessManager>

class downloader : public QObject
{
    Q_OBJECT
public:
    explicit downloader(QObject *parent = 0);
    void doDownload();

signals:

public slots:
    void stateChanged(int state);

private:
   QNetworkAccessManager *http;

};

#endif // DOWNLOADER_H

Solution

  • You need to provide your compile output so we can help you, right now you have only given us the warnings from the issue output.

    I usally get this error when i have a reference error on OSX. I.e when i have declared a function in my .h file and then haven't declared it.

    have you tested moving the stateChanged function to be public instead of a slot?

    what happens when you try to follow the function by rightclicking on the function in the .cpp file and choose follow symbol under cursor.

    If the connection is wrong between the .cpp and .h file you will get an error there. You can also try to declare the function in the .h file to test it.

    The warning you are getting is a warning you always get and it shouldn't make the app not runnable. I get it everytime i run applications.

    Please provide the compile output.

    Regards /RK