1
General / Re: AW: error: redefinition of new
« on: December 22, 2014, 01:35:43 am »
I downloaded SFML2.2 from the all source code on the download page and built it my self.
Though it seems unrelated from linking as I removed the link to sfml and I still get the same error.
It seems to be this section of code in tools.h that is being a hassle
While it might seem obvious this is the problem it is not as when I remove the SFML include it all builds fine.
Deleting this section of code is not really an option either as then the rest of the code will not build.
Edit:
Never mind I worked it out.
The code snipet above was implementing a "placement new".
There is also an include for placement new which can be included by "#include <new> "
presumably SFML calls this somewhere and that is why it is redeclared.
I just deleted the above snipet and put a "#include <new>" there instead
Though it seems unrelated from linking as I removed the link to sfml and I still get the same error.
It seems to be this section of code in tools.h that is being a hassle
Quote
inline void *operator new(size_t, void *p) { return p; }
inline void *operator new[](size_t, void *p) { return p; }
inline void operator delete(void *, void *) {}
inline void operator delete[](void *, void *) {}
While it might seem obvious this is the problem it is not as when I remove the SFML include it all builds fine.
Deleting this section of code is not really an option either as then the rest of the code will not build.
Edit:
Never mind I worked it out.
The code snipet above was implementing a "placement new".
There is also an include for placement new which can be included by "#include <new> "
presumably SFML calls this somewhere and that is why it is redeclared.
I just deleted the above snipet and put a "#include <new>" there instead