Jump to content
  • Advertisement
Sign in to follow this  
supagu

gcc compile errors

This topic is 4126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i've nearly finished porting my game over from windows to linux, but have a few more compiler errors which arent an issue under visual studio:
template <class T>
void StateMachine<T>::SetState(int stateType)
{
	vector<T*>::iterator it;
	for (it = mState.begin(); it != mState.end(); ++it)
	{
		if ((*it)->GetType() == stateType)
		{
			SetState(*it);
			return;
		}
	}
}

errors:

/home/bronson/workspace/Project/AirBlimbs/Source/Util/StateMachine.h:56: error: expected `;' before ‘it’
/home/bronson/workspace/Project/AirBlimbs/Source/Util/StateMachine.h:57: error: ‘it’ was not declared in this scope

virtual bool ConvertToNetwork(Packet* data)				
	{
		*data & mPhysModel->GetMessageHandle();
// other code here
}


should be using this one:
template <class T>
Packet& operator &(Packet& packet, T& data)
{
// code
}

the other chandidate:
Packet& operator &(Packet& packet, ServerInfo& data);

error:
/home/bronson/workspace/Project/AirBlimbs/Source/Entity/PhysicsModel.h: In member function ‘virtual bool SyncPhysicsModelMsg::ConvertToNetwork(Packet*)’:
/home/bronson/workspace/Project/AirBlimbs/Source/Entity/PhysicsModel.h:194: error: no match foroperator&’ in ‘* data & ((SyncPhysicsModelMsg*)this)->SyncPhysicsModelMsg::mPhysModel->PhysicsModel::<anonymous>.Entity::<anonymous>.MessageReceiver::GetMessageHandle()’
/home/bronson/workspace/Library/Network/Packet.h:48: note: candidates are: Packet& operator&(Packet&, T&) [with T = MessageReceiverHandle]
/home/bronson/workspace/Library/MasterServer/MasterServer.h:45: note:                 Packet& operator&(Packet&, ServerInfo&)
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h:157: note:                 std::_Ios_Iostate std::operator&(std::_Ios_Iostate, std::_Ios_Iostate)
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h:119: note:                 std::_Ios_Openmode std::operator&(std::_Ios_Openmode, std::_Ios_Openmode)
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h:79: note:                 std::_Ios_Fmtflags std::operator&(std::_Ios_Fmtflags, std::_Ios_Fmtflags)

any help appreciated

Share this post


Link to post
Share on other sites
Advertisement
Quote:
/home/bronson/workspace/Project/AirBlimbs/Source/Util/StateMachine.h:56: error: expected `;' before ‘it’
/home/bronson/workspace/Project/AirBlimbs/Source/Util/StateMachine.h:57: error: ‘it’ was not declared in this scope

When using nested classes and the external one is templated, you must specify that what you worte is a type name, so:

typename vector<T*>::iterator it;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!