Sign in to follow this  
simonloach

Wierd compiler errors

Recommended Posts

simonloach    130
I'm writing input handling into my game using a callback function that is called when the input is updated.
Application::Start(InputManager* inputmanager)
{
	// ...

	boost::function<void (const Controller& c)> fn;

	fn = boost::bind(&Application::InputCallback, this);

	inputmanager->RegisterCallback(fn);
}

void Application::InputCallback(const Controller& c)
{
	// ...
}

Compiler output:
1>------ Build started: Project: shadow_mapping, Configuration: Debug Win32 ------
1>Compiling...
1>Application.cpp
1>d:\project\lib\boost_1_35_0\boost\bind.hpp(1613) : warning C4180: qualifier applied to function type has no meaning; ignored
1>        d:\project\lib\boost_1_35_0\boost\bind.hpp(1647) : see reference to class template instantiation 'boost::_bi::add_cref<Pm,I>' being compiled
1>        with
1>        [
1>            Pm=void (__thiscall Application::* )(const Controller &),
1>            I=1
1>        ]
1>        d:\project\shadow_mapping\application.cpp(102) : see reference to class template instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled
1>        with
1>        [
1>            Pm=void (__thiscall Application::* )(const Controller &),
1>            A1=Application *
1>        ]
1>d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(318) : warning C4180: qualifier applied to function type has no meaning; ignored
1>        d:\project\lib\boost_1_35_0\boost\bind\bind_template.hpp(344) : see reference to class template instantiation 'boost::_mfi::dm<R,T>' being compiled
1>        with
1>        [
1>            R=void (const Controller &),
1>            T=Application
1>        ]
1>        d:\project\shadow_mapping\application.cpp(102) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
1>        with
1>        [
1>            R=void (\
1>d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(326) : warning C4180: qualifier applied to function type has no meaning; ignored
1>d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(331) : warning C4180: qualifier applied to function type has no meaning; ignored
1>d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(345) : warning C4180: qualifier applied to function type has no meaning; ignored
1>d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(350) : warning C4180: qualifier applied to function type has no meaning; ignored
1>d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(362) : warning C4180: qualifier applied to function type has no meaning; ignored
1>d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(342) : fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'msc1.cpp', line 1411)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>Please choose the Technical Support command on the Visual C++ 
1> Help menu, or open the Technical Support help file for more information
1>        d:\project\lib\boost_1_35_0\boost\mem_fn.hpp(341) : while compiling class template member function 'void (\
1>        d:\project\lib\boost_1_35_0\boost\bind\bind_template.hpp(344) : see reference to class template instantiation 'boost::_mfi::dm<R,T>' being compiled
1>        with
1>        [
1>            R=void (const Controller &),
1>            T=Application
1>        ]
1>        d:\project\shadow_mapping\application.cpp(102) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled
1>        with
1>        [
1>            R=void (\
1>Build log was saved at "file://d:\project\shadow_mapping\Debug\BuildLog.htm"
1>shadow_mapping - 1 error(s), 7 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Share this post


Link to post
Share on other sites
SiCrane    11839
You're missing the argument placeholder in your bind expression.

fn = boost::bind(&Application::InputCallback, this, _1);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this