g ++ ld:对于架构x86_64找不到符号 [英] g++ ld: symbol(s) not found for architecture x86_64

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

问题描述

我正在尝试编译Sam Hare的 Struck代码

I'm trying to compile the Sam Hare's Struck code.

我使用mac OSX10.9,opencv 2.4.6和Eigen 2.0.17。

I'm using mac OSX10.9, opencv 2.4.6 and Eigen 2.0.17.

Eigen和opencv头文件存储在/ opt / local / include,而opencv dylib在/ opt / local / lib中。

Eigen and opencv headers are stored in /opt/local/include while opencv dylib in /opt/local/lib.

我修改了Hare的Makefile,当我在终端上键入make:

I modified the Hare's Makefile to work on this folder. When I type make on the terminal:

g++ -L/opt/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc src/Config.o src/Features.o src/HaarFeature.o src/HaarFeatures.o src/HistogramFeatures.o src/ImageRep.o src/LaRank.o src/MultiFeatures.o src/RawFeatures.o src/Sampler.o src/Tracker.o src/main.o src/GraphUtils/GraphUtils.o -o struck

Undefined symbols for architecture x86_64:  
"cv::namedWindow(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
int)", referenced from:
      _main in main.o   "cv::split(cv::Mat const&, std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&)",
referenced from:
      ImageRep::ImageRep(cv::Mat const&, bool, bool, bool) in ImageRep.o   "cv::imread(std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > const&,
int)", referenced from:
      _main in main.o   "cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&,
cv::_InputArray const&)", referenced from:
      LaRank::Debug() in LaRank.o
      Tracker::Debug() in Tracker.o
      _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see
invocation)

任何想法?谢谢!

推荐答案

终于解决了我的问题。

我在XCode中创建了一个新项目, libc ++至libstdc ++,如

I created a new project in XCode with the sources and changed the C++ Standard Library from the default libc++ to libstdc++ as in this and this.

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

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