I'm a newbie to qt and opencv
using qt creator 3 with qt 5 on os x 10.9.1 opencv 2.4.8
When i'm trying out with my first program, i get this error.
Any one please help me.
Thank you
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main()
{
//read image
Mat image = imread("img.jpg");
//create image window named "My image"
namedWindow("My Image", CV_WINDOW_AUTOSIZE);
//show the image on window
imshow("My image", image);
//wait key for 5000ms
waitKey(5000);
return 0;
}
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main()
{
//read image
Mat image = imread("img.jpg");
//create image window named "My image"
namedWindow("My Image", CV_WINDOW_AUTOSIZE);
//show the image on window
imshow("My image", image);
//wait key for 5000ms
waitKey(5000);
return 0;
}
To copy to clipboard, switch view to plain text mode
test.pro
QT += core
QT -= gui
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib \
-opencv_core.dylib \
-opencv_imgproc.dylib \
-opencv_highgui.dylib \
-opencv_features2d.dylib \
-opencv_calib3d.dylib
OTHER_FILES += img.jpg
SOURCES += main.cpp
QT += core
QT -= gui
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib \
-opencv_core.dylib \
-opencv_imgproc.dylib \
-opencv_highgui.dylib \
-opencv_features2d.dylib \
-opencv_calib3d.dylib
OTHER_FILES += img.jpg
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
Error generated
Undefined symbols for architecture x86_64:
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
_main in main.o
"cv::namedWindow(std::string const&, int)", referenced from:
_main in main.o
"cv::Mat::deallocate()", referenced from:
_main in main.o
"cv::imread(std::string const&, int)", referenced from:
_main in main.o
"cv::imshow(std::string const&, cv::_InputArray const&)", referenced from:
_main in main.o
"cv::waitKey(int)", referenced from:
_main in main.o
"cv::fastFree(void*)", 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: *** [test] Error 1
23:13:36: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project test (kit: Desktop Qt 5.2.0 clang 64bit)
When executing step 'Make'
Undefined symbols for architecture x86_64:
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
_main in main.o
"cv::namedWindow(std::string const&, int)", referenced from:
_main in main.o
"cv::Mat::deallocate()", referenced from:
_main in main.o
"cv::imread(std::string const&, int)", referenced from:
_main in main.o
"cv::imshow(std::string const&, cv::_InputArray const&)", referenced from:
_main in main.o
"cv::waitKey(int)", referenced from:
_main in main.o
"cv::fastFree(void*)", 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: *** [test] Error 1
23:13:36: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project test (kit: Desktop Qt 5.2.0 clang 64bit)
When executing step 'Make'
To copy to clipboard, switch view to plain text mode
Bookmarks