SFML community forums
Help => General => Topic started by: greeniekin on December 21, 2014, 11:48:56 pm
-
I am using codeblocks on windows.
i added "#include <SFML/Audio.hpp>" to a file now when I compile I get
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void* operator new(std::size_t, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|111|error: redefinition of 'void* operator new(std::size_t, void*)'|
..\shared\tools.h|36|error: 'void* operator new(size_t, void*)' previously defined here|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void* operator new [](std::size_t, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|113|error: redefinition of 'void* operator new [](std::size_t, void*)'|
..\shared\tools.h|37|error: 'void* operator new [](size_t, void*)' previously defined here|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void operator delete(void*, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|117|error: redefinition of 'void operator delete(void*, void*)'|
..\shared\tools.h|38|error: 'void operator delete(void*, void*)' previously defined here|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new||In function 'void operator delete [](void*, void*)':|
c:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\c++\new|118|error: redefinition of 'void operator delete [](void*, void*)'|
..\shared\tools.h|39|error: 'void operator delete [](void*, void*)' previously defined here|
||=== Build finished: 8 errors, 0 warnings (0 minutes, 2 seconds) ===|
I tried including System instead and same errors the errors do not make sense to me. Soon as I remove the include everything is fine.
Edit:
here is the tools.h file http://websvn.tuxfamily.org/filedetails.php?repname=tesseract%2Fmain&path=%2Fsrc%2Fshared%2Ftools.h
-
Which SFML file/package did you download?
-
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
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
-
Never had this issue with any compiler incl. the TDM 4.7.1. Thus I'm certain the error occures due to something else.