Jump to content

  • Log In with Google      Sign In   
  • Create Account


c++ syntax error


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
4 replies to this topic

#1 heh65532   Members   -  Reputation: 150

Like
0Likes
Like

Posted 03 April 2013 - 07:54 AM

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

 
 


Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9500

Like
0Likes
Like

Posted 03 April 2013 - 08:00 AM

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

Edited by SiCrane, 03 April 2013 - 08:00 AM.


#3 heh65532   Members   -  Reputation: 150

Like
0Likes
Like

Posted 03 April 2013 - 09:26 AM

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

 

did now but it didn't help.

thanks



#4 SiCrane   Moderators   -  Reputation: 9500

Like
0Likes
Like

Posted 03 April 2013 - 10:29 AM

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

#5 heh65532   Members   -  Reputation: 150

Like
0Likes
Like

Posted 03 April 2013 - 10:41 AM

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






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