Qt Creator projects breaking: symbols not found for architecture x86_64
It is not that the linker error is as given. There's way more to it, and you're not including the meat of the message that actually carries meaningful information allowing to debug this issue. Your problem is possibly with the project becoming internally binary-incompatible, and qmake build system not catching onto it. The issue has nothing to do with Qt Creator. The build is done by qmake and make. You'll see those problems if you build from the command line - which I highly advise you to do.
Assuming the sources are in /Users/mycaptain/src/myproject
, and that you're using Qt from macports, proceed as follows in terminal:
$ mkdir ~/src/build-myproject
$ cd ~/src/build-myproject
$ /opt/local/libexec/qt5/bin/qmake ../myproject
$ make
ld: symbol(s) not found for architecture x86_64 qt
I made a very basic mistake. Everything was working, but the Makefile outputted a main.o
file. I tried to execute my application by using ./main.o
. This is not possible.
The correct way to execute a Qt application is by using open main.app
.
No need to alter the makefile.
- Create a myApp.pro file
Example:
TEMPLATE += app
QT += widgets gui
SOURCES += myApp.cpp
- Execute
qmake
- Execute
make
- Execute
open myApp.app
qt compile error: symbol(s) not found for architecture x86_64
It means that there are following problems:
- You are linking 32-bit dylib when you should link 64-bit
- Linker is unable to find the library
- Or the required symbol is not present in the library.
You can look into compiler and linker option to make sure that library is being linked. Use nm
or string
to ensure that the functions are present in the library.
Symbol(s) not found for architecture x86_64 in QtCreator unsing OpenCV
Ok, after looking around in the Internet i found the following Solution :
INCLUDEPATH += /opt/local/include
LIBS += -L/opt/local/lib
LIBS += -lopencv_calib3d \
-lopencv_contrib \
-lopencv_core \
-lopencv_features2d \
-lopencv_flann \
-lopencv_gpu \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_legacy \
-lopencv_ml \
-lopencv_objdetect \
-lopencv_video
Related Topics
How to Print the Full Value of a Long String in Gdb
C++ Access Derived Class Member from Base Class Pointer
Move or Named Return Value Optimization (Nrvo)
How to Use Windbg to Analyze the Crash Dump for Vc++ Application
Differencebetween a Concrete Class and an Abstract Class
Advantages of Std::For_Each Over for Loop
C++ Equivalent of Stringbuffer/Stringbuilder
Converting Data from Glreadpixels() to Opencv::Mat
Can Class Template Constructors Have a Redundant Template Parameter List in C++20
Why Do I Get _Crtisvalidheappointer(Block) And/Or Is_Block_Type_Valid(Header->_Block_Use) Assertions