未找到用于架构x86_64 os x lion的符号 [英] symbol(s) not found for architecture x86_64 os x lion

查看:205
本文介绍了未找到用于架构x86_64 os x lion的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当试图编译一个简单的c ++ test.cpp代码与opencv 2.3.1作为第三个
库,我得到以下错误信息:

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:


架构x86_64的未定义符号:

Undefined symbols for architecture x86_64:

有关信息,我使用CMake链接, 4.2.1从Xcode 4.2获取的i686-apple-darwin11
。 OpenCV已使用CMake安装:

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:

请注意,我在尝试编译SoQt时会收到类似的消息
(coin3D),后面的命令./configure& sudo make:

Note please that I get a similar message when trying to compile SoQt (coin3D), after commands ./configure & sudo make:




. . .

主项目的CMakeLists.txt是:

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 )

test.cpp的CMakeLists.txt是:

While the CMakeLists.txt for test.cpp is:

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

也许这个问题在于OpenCV需要以64位(?)编译。我发现了一个有趣的链接。但我想知道如何应用于CMake。

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.

有任何帮助吗?

推荐答案

这看起来您没有正确链接库。在stackoverflow上有至少两个类似的问题处理这个问题,即这一个那一个。你看看他们吗?此外,请提供有关如何编译的详细信息。您可以编译一个简单的OpenCV测试程序,例如这个(取自他们的wiki ):



This looks like you are not linking against the library correctly. There are at least two similar questions on stackoverflow that deal with this issue, namely this one and that one. Did you take a look at them? Furthermore, please supply more information about how you are compiling. Can you compile a simple OpenCV test program such as this one (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;
}

这篇关于未找到用于架构x86_64 os x lion的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆