我已經在Mac OS Mavericks和QT Creator中使用Homebrew在網站上安裝了OpenCV。如何在MacOS X中連接OpenCV 2.4.9和Qt Creator X
我想測試OpenCV & QT Creator使用一個簡單的程序從互聯網上,但我最後有一些錯誤。
我唐諾WATS去錯了....我是新來opencv的和QT ...您的幫助,非常感謝..
下面是我的項目的詳細信息。指導我爲我的第一次OpenCV & QT與Mac OS X程序.....
Thx。
--- Untitled.pro文件---
QT += core
QT -= gui
TARGET = untitled1
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
LIBS += -L/usr/local/Cellar/opencv/2.4.9/lib \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_core \
-lopencv_features2d \
-lopencv_calib3d \
INCLUDEPATH += /usr/local/Cellar/opencv/2.4.9/include \
---源文件 - main.cpp中---
include opencv2/core/core.hpp
include opencv2/highgui/highgui.hpp
include iostream
include opencv/cv.h
using namespace cv;
int main()
{
std::cout << "Hello World!" << std::endl;
cv::Mat mat;
mat = cv::imread("Unknown.JPEG");
cvNamedWindow("hello");
cv::imshow("hello",mat);
cvWaitKey(0);
return 0;
}
---該編譯有錯誤的輸出---
14:30:57: Running steps for project untitled... 14:30:57: Configuration unchanged, skipping qmake step. 14:30:57: Starting: "/usr/bin/make" /Users/Macs/Qt/5.3.1/bin/qmake -spec macx-g++ CONFIG+=debug CONFIG+=x86_64 -o Makefile ../untitled/untitled.pro /Applications/Xcode.app/Contents/Developer/usr/bin/g++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.6 -o untitled main.o -F/usr/local/Cellar/qt5/5.3.1/lib -L/usr/local/Cellar/opencv/2.4.9/lib -lopencv_highgui -lopencv_imgproc -lopencv_core -lopencv_features2d -lopencv_calib3d -framework QtCore Undefined symbols for architecture x86_64: "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 ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: * [untitled] Error 1 14:30:57: The process "/usr/bin/make" exited with code 2. Error while building/deploying project untitled (kit: Desktop) When executing step "Make" 14:30:57: Elapsed time: 00:00.