Sign in to follow this  
heh65532

c++ syntax error

Recommended Posts

Hi

i ran to this problem that I cannot figure out what's causing it. I'm using visual studio 2010 express (C++) and first this code seeme'd to work but running clean-build ends up in error.

 

code:

 

template<class Archive,class EntClass> inline 
void loadEntityConstructData(Archive & ar, EntClass * obj, const unsigned int version)
{

 Point2F pos;
 F32 angle;
 std::string data;

 EntityData *entData = 0;

  ::new(obj)EntClass(*entData,pos,angle);

}

 

 

 
 
 
Gives error:
 
Error 220 error C2061: syntax error : identifier 'obj'
 
 

the code above is called from another template function:

 

 

template<class Archive> inline void load_construct_data(Archive & ar, classname * t, const unsigned int version) 
{ loadEntityConstructData(ar,t,version); }  
 

 

maybe someone knows what's wrong?

 

thanks

 
 

Share this post


Link to post
Share on other sites
Did you try removing the scope operator :: from the new call? Edited by SiCrane

Share this post


Link to post
Share on other sites

i found the problem. the new was actually overrided and that caused the problem.

 

#define DEBUG_NEW new(_NORMAL_BLOCK,__FILE__, __LINE__)_)
#define new DEBUG_NEW

 

for the memory leak detecting code. not sure if there's better way overloading the new.

 

thanks in anycase

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