【发布时间】:2012-10-04 08:59:08
【问题描述】:
我需要在我的程序中使用绑定和函数。但不幸的是vs2010无法链接我的程序。 我使用了 boost::bind 文档中的以下示例
#include <boost\bind.hpp>
#include <boost\function.hpp>
#include <functional>
class button
{
public:
boost::function<void()> onClick;
};
class player
{
public:
void play();
void stop();
};
button playButton, stopButton;player thePlayer;
void connect()
{
playButton.onClick = boost::bind(&player::play, &thePlayer);
stopButton.onClick = boost::bind(&player::stop, &thePlayer);
}
void main(int argc, char* argv[])
{
connect();
}
错误 1 错误 LNK2019:函数“void __cdecl connect(void)”(?connect@@YAXXZ) 中引用的未解析外部符号“public: void __thiscall player::stop(void)”(?stop@player@@QAEXXZ) )
我已经尝试了最新的 32 和 64 版本的 BoostPro 并按照本教程进行操作 http://www.youtube.com/watch?v=5AmwIwedTCM.All 但 vs 仍然产生相同的错误...
VS2010项目设置include/lib路径 https://dl.dropbox.com/u/47585151/vs.png
但是当我打开时
Linker->General->ShowProgress ->对于搜索的库 (/VERBOSE:Lib)
我注意到 VS 只搜索在
中定义的这些库链接器->输入->附加依赖
vs2010下是否可以检查boost::bind和boost::function需要哪个.lib boost?
【问题讨论】:
标签: c++ visual-studio-2010 boost linker