Why mac cannot build opencv file ? [closed]

asked 2016-01-23 09:40:33 -0600

Hi there,

I have mac El Capitan 10.11.2. I installed opencv 2.4.11 I follow many tutorials and non of them working. When I build my program like this cmake . make It generate the following errors. Can anybody guid me with a lot of thanks. sss:NewNetwork salemalqahtani$ make [ 50%] Linking CXX executable NewNetwork Undefined symbols for architecture x86_64: "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::rect_<int>, std::__1::allocator<cv::rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)", referenced from: input_option() in server.cpp.o thread_comm(void) in server.cpp.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[2]: [NewNetwork] Error 1 make[1]: [CMakeFiles/NewNetwork.dir/all] Error 2 make: ** [all] Error 2

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-13 13:33:29.071461

Comments

Use hombrew, you'll get what you want with almost zero effort.

Der Luftmensch gravatar imageDer Luftmensch ( 2016-01-23 12:28:17 -0600 )edit

What do you mean ? Can you be more specific.

salemalqahtani gravatar imagesalemalqahtani ( 2016-01-23 12:29:47 -0600 )edit

Homebrew is a package manager for OS X. Google is your friend here. Learning it won't take but 15 minutes. To get libraries installed is a simple command "brew install opencv3". If you want to know the installation options, type "brew options opencv3". Search for libraries with "brew search <library name="">". Homebrew formula scripts take care of installing all necessary dependencies. And you are often able to choose between a pre-built library and one compiled on your system. It's great, look into it.

Der Luftmensch gravatar imageDer Luftmensch ( 2016-01-23 12:33:48 -0600 )edit

I install everything again used home-brew but I still have the same problem

salemalqahtani gravatar imagesalemalqahtani ( 2016-01-24 15:14:19 -0600 )edit

cmake_install.cmake sss:server salemalqahtani$ cmake . -- Configuring done -- Generating done -- Build files have been written to: /Users/salemalqahtani/Desktop/server sss:server salemalqahtani$ make [ 50%] Linking CXX executable server Undefined symbols for architecture x86_64: "cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::rect_<int>, std::__1::allocator<cv::rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)", referenced from: input_option() in server.cpp.o thread_comm(void) in server.cpp.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[2]: [server] Error 1 make[1]: [CMakeFiles/server.dir/all] Error 2 make: ** [all] Error

salemalqahtani gravatar imagesalemalqahtani ( 2016-01-24 16:03:47 -0600 )edit

From what I can tell of your error, you are not having trouble building opencv on a mac as the title implies. You are having trouble building an application that uses opencv on a mac. For one thing, make sure OpenCV was built with clang and not gcc. In reality it seems your problem has nothing to do with OpenCV and everything to do with how you are compiling and linking your program.

Der Luftmensch gravatar imageDer Luftmensch ( 2016-01-24 18:45:06 -0600 )edit

My code is working fine with my linux computer

salemalqahtani gravatar imagesalemalqahtani ( 2016-01-24 19:47:07 -0600 )edit