When trying to compile a simple c++ test.cpp code with opencv 2.3.1 as as third library, I get the following error message:
Undefined symbols for architecture x86_64:
"_cvLoadImage", referenced from: _main in test.cpp.o ld: symbol(s) not found for architecture x86_64
For info, am using CMake for linking, and gcc 4.2.1 i686-apple-darwin11 obtained from Xcode 4.2. OpenCV had been installed using CMake:
ccmake ../sourcecodeNote please that I get a similar message when trying to compile SoQt (coin3D), after commands ./configure & sudo make:
. . .
"typeinfo for QWidget", referenced from: typeinfo for SoQtThumbWheelin SoQtThumbWheel.o "QWidget::staticMetaObject", referenced from: SoQtThumbWheel::staticMetaObject in SoQtThumbWheel.o ld: symbol(s) not found for architecture x86_64 collect2: ld returned 1 exit status
The CMakeLists.txt of the main project is:
cmake_minimum_required(VERSION 2.8)
PROJECT(TOTO )
FIND_PACKAGE(OpenCV)
INCLUDE_DIRECTORIES(${TOTO_SOURCE_DIR}/src/control)
SET(ALL_LIB_RAF ${OPENCV_LIBRARIES}
Hello
)
# FILEs to consider
ADD_SUBDIRECTORY(main)
ADD_SUBDIRECTORY( src )
While the CMakeLists.txt for test.cpp is:
ADD_EXECUTABLE(helloWorld test)
TARGET_LINK_LIBRARIES(helloWorld ${ALL_LIB_RAF} )
Perhaps the issue consists in the fact that OpenCV needs to be compiled in 64-bit (?). I found an interesting link. But am wondering how that mights be applied to CMake.
Any help please?
Thanks.