Why mac cannot build opencv file ? [closed]
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
Use hombrew, you'll get what you want with almost zero effort.
What do you mean ? Can you be more specific.
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.
I install everything again used home-brew but I still have the same problem
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
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.
My code is working fine with my linux computer