Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

add on std::string


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Rain Dog   Members   -  Reputation: 136

Like
0Likes
Like

Posted 02 November 2004 - 12:26 PM

I am unable to compile the code dealing with the overloaded operators.
	//r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL,       "bool f(const string &, const string &)", asFUNCTIONPR(operator==, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );

	r = engine->RegisterGlobalBehaviour(asBEHAVE_NOTEQUAL,    "bool f(const string &, const string &)", asFUNCTIONPR(operator!=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
	r = engine->RegisterGlobalBehaviour(asBEHAVE_LEQUAL,      "bool f(const string &, const string &)", asFUNCTIONPR(operator<=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
	r = engine->RegisterGlobalBehaviour(asBEHAVE_GEQUAL,      "bool f(const string &, const string &)", asFUNCTIONPR(operator>=, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
	r = engine->RegisterGlobalBehaviour(asBEHAVE_LESSTHAN,    "bool f(const string &, const string &)", asFUNCTIONPR(operator <, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
	r = engine->RegisterGlobalBehaviour(asBEHAVE_GREATERTHAN, "bool f(const string &, const string &)", asFUNCTIONPR(operator >, (const string &, const string &), bool), asCALL_CDECL); assert( r >= 0 );
	r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD,         "string f(const string &, const string &)", asFUNCTIONPR(operator +, (const string &, const string &), string), asCALL_CDECL); assert( r >= 0 );

gives me the following error: c:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\TestingDDX\ASRegisterVector.cpp(415): fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2701) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information It occurs for each of the above lines of code.

Sponsor:

#2 kaysik   Members   -  Reputation: 382

Like
0Likes
Like

Posted 02 November 2004 - 06:27 PM

download the latest VC6 service pack (think its 6) and it should fix your problem. If its the same error i had its a bug in the compiler not in AS.

Easily found HERE

#3 Rain Dog   Members   -  Reputation: 136

Like
0Likes
Like

Posted 02 November 2004 - 06:51 PM

I am using VS.NET 2003

#4 kaysik   Members   -  Reputation: 382

Like
0Likes
Like

Posted 02 November 2004 - 08:12 PM

lol - its not that then :P

#5 Andreas Jonsson   Moderators   -  Reputation: 3444

Like
0Likes
Like

Posted 03 November 2004 - 01:04 AM

This is obviously a bug in MSVC.NET 2003. If there is no patch available, then you will have to try to find some workaround.

Perhaps it works if you write some wrapper functions for the operators? Example:

string Concatenate(const string &a, const string &b)
{
return a+b;
}

r = engine->RegisterGlobalBehaviour(asBEHAVE_ADD, "string f(const string &, const string &)", asFUNCTION(Concatenate), asCALL_CDECL); assert( r >= 0 );

Or maybe it is sufficient to use the namespace prefix std:: on the string type?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#6 Rain Dog   Members   -  Reputation: 136

Like
0Likes
Like

Posted 03 November 2004 - 07:43 AM

Yes, that is what i have done. I have wrapper functions. It just seems much nicer to not have them.

#7 Andreas Jonsson   Moderators   -  Reputation: 3444

Like
0Likes
Like

Posted 03 November 2004 - 09:25 AM

I agree with you. However, Microsoft doesn't always do so [wink].

I hope they fix the problem in a future patch.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#8 Deyja   Members   -  Reputation: 920

Like
0Likes
Like

Posted 03 November 2004 - 11:27 AM

This used to happen quite a bit in MSVC6.0 with partial specilization of member templates. I'd suspect microsoft still hasn't gotten that right, and the compiler can't resolve the pointers to template functions.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS