8
I recently installed Qt Creator and Opencv. I was able to easily compile QT and Opencv separately. But I can’t compile both together. My file .pro
is like this:
#-------------------------------------------------
#
# Project created by QtCreator 2015-06-27T12:52:47
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Older
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_objdetect \
-lopencv_calib3d
QMAKE_CXXFLAGS+=-std=c++11
QMAKE_CXXFLAGS+=-stdlib=libc++
QMAKE_LFLAGS+=-std=c++11
QMAKE_LFLAGS+=-stdlib=libc++
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
The problem is that if I leave the main.cpp file this way compiles normally:
#include "mainwindow.h"
#include <QApplication>
#include <opencv2/opencv.hpp>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
If I add this single line I get the error "error: Symbol(s) not found for Architecture x86_64":
cv::Mat inputImage = cv::imread("/Users/pedrosoares/TESTEOpenCV/fefafofauroFex.png");
I’ve done everything, all it’s kind of forum but none worked on my mac.
I once compiled from the terminal using the Cmakelists.txt file. And it’s in the /usr/local/lib folder
– Pedro Soares
I am compiling for x86_64. I just added the INCLUDE you told me and I still get the same error.
– Pedro Soares
Yes, the same mistake. I forgot to mention and after the x86_64 error, the error "error: Linker command failed with Exit code 1 (use -v to see Invocation)"
– Pedro Soares
Pedro I offered a reward of 100 points to those who answer, hopefully this will help you get the desired answers. Good luck
– Guilherme Nascimento
What version of OSX and Xcode?
– bruno
OS 10.10.3 and Xcode 6.3.1, but I’m using QT Creator
– Pedro Soares
Try adding only the following to your . pro file: CONFIG += c++11. VERY IMPORTANT: Do not forget to clean and rebuild the project.
– bruno
So, have you solved it? If not, I can also offer another reward to try to help.
– Luiz Vieira