C++ OSX小牛上的OpenCV和Xcode
我正在尝试在Xcode中的OSX上运行OpenCV。我已经从github下载了代码。并使用cmake进行编译 接下来,我用以下代码创建了一个新的Xcode项目:C++ OSX小牛上的OpenCV和Xcode,c++,xcode,macos,opencv,osx-mavericks,C++,Xcode,Macos,Opencv,Osx Mavericks,我正在尝试在Xcode中的OSX上运行OpenCV。我已经从github下载了代码。并使用cmake进行编译 接下来,我用以下代码创建了一个新的Xcode项目: #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv; using namespace std; int main( int ar
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
if( argc != 2)
{
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread("img.jpg"); // Read the file
if(! image.data ) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
namedWindow( "Display window", WINDOW_AUTOSIZE );// Create a window for display.
imshow( "Display window", image ); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
我做错什么了吗 在搜索标题路径时, 双击该属性。如果你看到空字符串 不要进入那里, 慢慢地轻按两次,它会弹出一个新的属性列表 在“值”下添加新值,然后按enter键 但如果它不起作用,
检查您的字符串您还应该将
/usr/local/lib
添加到库搜索路径。我想这就是我所做的。我已经像这样设置了标题搜索路径:-但是它不是与库相关的东西而不是标题搜索路径吗?(因为它可以正确地自动完成OpenCV代码)。
ld: library not found for -lopencv_core.3.0.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)