Symbol not found for x86_64 os x lion architecture

When I try to compile a simple C ++ code test.cpp with opencv 2.3.1 as the third, I get the following error message:

Undefined characters for x86_64 architecture:

"_cvLoadImage" referenced: _main in test.cpp.old: character not found for x86_64 architecture

For information, I use CMake for communication, and gcc 4.2.1 i686-apple-darwin11 obtained from Xcode 4.2. OpenCV was installed using CMake:

ccmake ../ sourcecode

Please note that I get a similar message when I try to compile SoQt (coin3D), after the commands. / configure and sudo make:

. ,,

"typeinfo for QWidget" referenced: typeinfo for SoQtThumbWheelin SoQtThumbWheel.o "QWidget :: staticMetaObject" referenced: SoQtThumbWheel :: staticMetaObject in SoQtThumbWheel.old: characters (characters) x86 not found for 1 exit status

CMakeLists.txt of the main project:

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 ) 

Whereas CMakeLists.txt for test.cpp:

 ADD_EXECUTABLE(helloWorld test) TARGET_LINK_LIBRARIES(helloWorld ${ALL_LIB_RAF} ) 

Perhaps the problem is that OpenCV needs to be compiled into 64-bit (?). I found an interesting link. But I wonder how these sights apply to CMake.

Any help please?

Thanks.
+4
source share
2 answers

It looks like you are not properly linking to the library. There are at least two similar stackoverflow questions that address this issue, namely this one and this one . Have you looked at them? Also, please provide additional information on how you compile. You can compile a simple OpenCV testing program such as this (taken from their wiki ):

 #include <cv.h> #include <highgui.h> int main ( int argc, char **argv ) { cvNamedWindow( "My Window", 1 ); IplImage *img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 1 ); CvFont font; double hScale = 1.0; double vScale = 1.0; int lineWidth = 1; cvInitFont( &font, CV_FONT_HERSHEY_SIMPLEX | CV_FONT_ITALIC, hScale, vScale, 0, lineWidth ); cvPutText( img, "Hello World!", cvPoint( 200, 400 ), &font, cvScalar( 255, 255, 0 ) ); cvShowImage( "My Window", img ); cvWaitKey(); return 0; } 
+4
source

I generated this error when I accidentally combined individual target_link_libraries () in my CMakeLists.txt file when compiling with cmake.

In particular, I made the right decision:

 target_link_libraries( GradientComputer ) target_link_libraries( Overlap PointAreaComputer ) 

and combine them to create the wrong one:

 target_link_libraries( GradientComputer Overlap PointAreaComputer ) 
+1
source

Source: https://habr.com/ru/post/1413995/


All Articles