5

I installed Qt 5.0.0 (qt-mac-opensource-5.0.0-clang-offline.dmg) on a Mac OS X 10.7.5 and now I'm trying to compile a "Hello World" application using Qt Creator 2.6.1.

The build process complains about a directory not found: /Users/karlphillip/Qt5.0.0/5.0.0/clang_64/qtbase/lib , followed by several linking errors:

clang++ -c -pipe -mmacosx-version-min=10.6 -O2 -Wall -W -fPIE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/mkspecs/macx-clang -I. -I/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/include -I/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/include/QtGui -I/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/lib/QtGui.framework/Versions/5/Headers -I/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/include/QtCore -I/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/System/Library/Frameworks/AGL.framework/Headers -o main.o main.cpp
clang++ -headerpad_max_install_names -mmacosx-version-min=10.6 -o hello_qt.app/Contents/MacOS/hello_qt main.o -F/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/lib -framework QtGui -F/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/qtbase/lib -framework QtCore -framework OpenGL -framework AGL
ld: warning: directory not found for option '-F/Users/karlphillip/Qt5.0.0/5.0.0/clang_64/qtbase/lib'
Undefined symbols for architecture x86_64:
"QApplication::QApplication(int&, char**, int)", referenced from:
_main in main.o
"QLabel::QLabel(QString const&, QWidget*, QFlags<Qt::WindowType>)", referenced from:
_main in main.o
"QWidget::show()", referenced from:
_main in main.o
"QPushButton::QPushButton(QString const&, QWidget*)", referenced from:
_main in main.o
"QApplication::exec()", referenced from:
_main in main.o
"QPushButton::~QPushButton()", referenced from:
_main in main.o
"QLabel::~QLabel()", referenced from:
_main in main.o
"QApplication::~QApplication()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [hello_qt.app/Contents/MacOS/hello_qt] Error 1

It's important to note that the path /Users/karlphillip/Qt5.0.0/5.0.0/clang_64/qtbase/lib is not valid because the directory qtbase doesn't exist. The working path is /Users/karlphillip/Qt5.0.0/5.0.0/clang_64/lib. I'm not referring to qtbase anywhere in my project, so this is probably being added by qmake.

2 Answers 2

12

As it turns out, the invalid qtbase path thing is really a Qt bug originally reported at QTBUG-28336.

The linking problem is due to my project not linking with QtWidgets, which is something we are going to have to do starting in Qt5. This is accomplished by adding the following line to your .pro file:

QT += widgets
Sign up to request clarification or add additional context in comments.

1 Comment

I tried this, and at first it fixed an immediate compile issue I had a few days ago. But now the issue has come back. There must be more to this issue. I am using OS X 10.7.5, Qt Creator 2.6.2, and Qt 5.0.1.
1

i had the same problem and to be honest im not shure how i managed it to solve.

i think/guess i copied the needed folders from the sources into the matching 'clang_64' folders and that does the job.

soo long zai

4 Comments

You copied in the qtbase folder? If so, where did you get it?
i found the qtbase directory in the 'QtSources'. if you have installed the sources of qt as well, you should find it in the installation directory of your qt installation.
I cannot find this on the internet or on my local machine. Would you mind clarifying what 'QtSources' is? Is it a directory? Am I missing it because I did not install the correct version of Qt?
ok i used the name that qt uses in the windows version ... if you have installed the qt package and selected that you want to 'install source code' you should have a directory under <QTINSTALLDIR>/5.x.x/Src/ and that should contain the missing qtbase directory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.