Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

Mac 10.10.4, opencv3.0 in qt creator can't use imwrite

asked 2015-08-06 03:55:10 -0500

charlesyin gravatar image

In my program, I want to use imwrite to save a picture, but I got two compile error, which says: error: symbol(s) not found for architecture x86_64 error: linker command failed with exit code 1 (use -v to see invocation) this is my program:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main()
cv::Mat image=cv::imread("/Users/yinxiangnan/Desktop/lena.jpg");
cv::namedWindow("My Image");
cv::Mat image1;
cv::imshow("My Image",image1);
return 0;

I can run the program in Xcode, and I can also run it after comment the imwrite line.

edit retag flag offensive close merge delete


Okay for a starter, you are using the wrong headers for OpenCV3.0

  • Change #include <opencv2/core/core.hpp> to #include <opencv2/core.hpp>
  • Change #include <opencv2/highgui/highgui.hpp> to #include <opencv2/highgui.hpp>

And then report back!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-06 04:04:52 -0500 )edit

Thank you, I changed it to what you said, but the error still exists

charlesyin gravatar imagecharlesyin ( 2015-08-06 04:35:33 -0500 )edit

Are you linking the correct OpenCV libraries?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-06 04:54:31 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-08-06 05:19:25 -0500

charlesyin gravatar image

By searching on the internet, I solved the problem. It's because the version of my Xcode is newer than the version defined in Qt3.0. So I have to modify the qmake.conf in the dirctory: ../Qt5.5.0/5.5/clang_64/mkspecs/macx-clang . After changed the QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 to QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10 My program works well.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-08-06 03:48:24 -0500

Seen: 756 times

Last updated: Aug 06 '15