I'm having a problem when trying to compile the program in this tutorial from the OpenCV 2.3 official documentation. I have created the CMakeList.txt like it's said in the link. Well, it didn't work.
After a good time searching Google and trying to fix it, I have added the correct lib and include folders to the OpenCVConfig.make (at /opt/local/share/opencv here). Well, this is the output when I try to make it:
$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/carlosagarie/dropbox/code/c++/opencv
$ make
Linking CXX executable teste
Undefined symbols for architecture x86_64:
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
_main in teste.cc.o
"cv::imshow(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)", referenced from:
_main in teste.cc.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [teste] Error 1
make[1]: *** [CMakeFiles/teste.dir/all] Error 2
make: *** [all] Error 2
Trying to find out why it said ld: symbol(s) not found for architecture x86_64, I looked at my libraries folder (/opt/local/lib) and used the file command:
libopencv_calib3d.2.2.0.dylib: Mach-O 64-bit dynamically linked shared library x86_64
The same for all the other libs. So, I assume that it's not a problem with them. But, why isn't ld working them? I really don't know what to do.
The code is the same as in the tutorial presented earlier. My CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8)
project( teste )
find_package( OpenCV REQUIRED )
add_executable( teste teste )
target_link_libraries( teste ${OpenCV_LIBS} )
Thanks in advance!