c++ syntax error

Started by
3 comments, last by heh65532 11 years ago

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

Advertisement
Did you try removing the scope operator :: from the new call?

Did you try removing the scope operator :: from the new call?

did now but it didn't help.

thanks

Another possibility is that you aren't using #include <new>.

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

This topic is closed to new replies.

Advertisement