未定义符号std :: __ throw_bad_function_call [英] Undefined symbol std::__throw_bad_function_call

查看:1465
本文介绍了未定义符号std :: __ throw_bad_function_call的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用g ++在Eclipse CDT中构建C ++代码,并得到以下链接器错误:

 未定义符号对于架构x86_64:
std :: __ throw_bad_function_call(),引用自:
std :: function< void(graphics :: RenderingContext *)& )const in GameWindow.o

我有 std :: function 一个名为GameWindow的类中的成员。



有一些东西,我必须链接到,以获得代码使用 std :: function

$ p $>

解决方案

结果我的lib路径没有正确设置g ++。 / p>

对于后代:我使用gcc 4.7进行编译,因为我需要C ++ 11的功能。 XCode(在OS X Mountain Lion上),附带gcc 4.2,所以我通过Homebrew安装了gcc 4.7。

为了使用gcc 4.7编译,我不得不改变路径到编译器和链接器在项目设置中对应于新安装的通过Homebrew版本。但是,我仍然有我的项目设置中的gcc 4.2 stdlibc ++的旧库路径。


I'm building C++ code in Eclipse CDT with g++ and I'm getting the following linker error:

Undefined symbols for architecture x86_64:
  "std::__throw_bad_function_call()", referenced from:
      std::function<void (graphics::RenderingContext*)>::operator()(graphics::RenderingContext*) const in GameWindow.o

I have std::function members in a class called GameWindow.

Is there something I have to link to in order to get code using std::function to link properly?

解决方案

Turns out my lib path wasn't set correctly for g++.

For posterity: I use gcc 4.7 for compiling because I need C++11 features. XCode (on OS X Mountain Lion), ships with gcc 4.2 so I installed gcc 4.7 through Homebrew.

For Eclipse to compile with gcc 4.7, I had to change the path to the compiler and linker in project settings to correspond to the newly installed via Homebrew version. However, I still had the old library path to the gcc 4.2 stdlibc++ in my project settings.

这篇关于未定义符号std :: __ throw_bad_function_call的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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