I need to use bind and function in my program.But unfortunately vs2010 can’t link my program.
I used following example from boost::bind documentation
#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();
}
Error 1 error LNK2019: unresolved external symbol “public: void __thiscall player::stop(void)” (?stop@player@@QAEXXZ) referenced in function “void __cdecl connect(void)” (?connect@@YAXXZ)
i have tried the newest 32 and 64 verion of BoostPro and followed this tutorial http://www.youtube.com/watch?v=5AmwIwedTCM.All but vs still produces same error…
VS2010 project setting include/lib path
https://dl.dropbox.com/u/47585151/vs.png
however when I turned on
Linker->General->ShowProgress ->For Libraries Searched (/VERBOSE:Lib)
i noticed that VS is searching only for these libraries which are defined in
Linker->Input->Additional Dependencies
is it possible to check which .lib boost need for boost::bind and boost::function under vs2010?
This problem has nothing to do with any boost library (both are header-only). Try to simply call
startandstopfrom withinconnectand you should get the same error. Read it carefully, it tells you what is missing.