   SDL Severe Error
  I've been working on a game for a while and when I finally start working on animation, I find odd errors that point back to include files that come with C++ ( GCC - Code::Blocks ) such asC:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\functexcept.h|36|error: expected `,' or `...' before "namespace"|I:\CodeBlocks\MinGW\include\locale.h|65|error: expected `)' before ';' token|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\c++locale.h||In function `int std::__convert_from_v(char*, int, const char*, _Tv, int* const&, int)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\c++locale.h|64|error: `strcmp' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\c++locale.h|66|error: `strlen' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\mingw32\bits\c++locale.h|67|error: `strcpy' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h||In function `_Tp* std::__copy_trivial(const _Tp*, const _Tp*, _Tp*)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h|258|error: `memmove' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h|407|error: `memmove' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h||In function `void std::fill(unsigned char*, unsigned char*, const unsigned char&)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h|556|error: `memset' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h||In function `void std::fill(signed char*, signed char*, const signed char&)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h|564|error: `memset' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h||In function `void std::fill(char*, char*, const char&)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h|572|error: `memset' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h||In function `bool std::lexicographical_compare(const unsigned char*, const unsigned char*, const unsigned char*, const unsigned char*)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_algobase.h|815|error: `memcmp' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h||In function `char* std::uninitialized_copy(const char*, const char*, char*)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h|119|error: `memmove' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h||In function `wchar_t* std::uninitialized_copy(const wchar_t*, const wchar_t*, wchar_t*)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h|127|error: `memmove' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\char_traits.h|186|error: `memmove' is not a member of `std'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\memory||In function `std::pair&lt;_Tp*, ptrdiff_t&gt; std::__get_temporary_buffer(ptrdiff_t, _Tp*)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\memory|84|error: `nothrow' was not declared in this scope|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\memory||In function `void std::return_temporary_buffer(_Tp*)':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\memory|124|error: `nothrow' was not declared in this scope|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|72|warning: `class audiere::RefCounted' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|229|warning: `class audiere::File' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|306|warning: `class audiere::SampleSource' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|425|warning: `class audiere::LoopPointSource' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|478|warning: `class audiere::OutputStream' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|595|warning: `class audiere::Event' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|610|warning: `class audiere::StopEvent' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|640|warning: `class audiere::Callback' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|668|warning: `class audiere::StopCallback' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|696|warning: `class audiere::AudioDevice' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|786|warning: `class audiere::SampleBuffer' has virtual functions but non-virtual destructor|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|839|warning: `class audiere::SoundEffect' has virtual functions but non-virtual destructor|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_construct.h||In function `void std::_Construct(_T1*, const _T2&) [with _T1 = std::string, _T2 = std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;]':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_vector.h|560|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::push_back(const _Tp&) [with _Tp = std::string, _Alloc = std::allocator&lt;std::string&gt;]'|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|1150|instantiated from here|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_construct.h|81|error: no matching function for call to `operator new(unsigned int, void*)'|||note: candidates are: void* operator new(unsigned int)|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_construct.h||In function `void std::_Construct(_T1*, const _T2&) [with _T1 = audiere::FileFormatDesc, _T2 = audiere::FileFormatDesc]':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h|86|instantiated from `_ForwardIterator std::__uninitialized_copy_aux(_InputIterator, _InputIterator, _ForwardIterator, __false_type) [with _InputIterator = audiere::FileFormatDesc*, _ForwardIterator = audiere::FileFormatDesc*]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h|112|instantiated from `_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = audiere::FileFormatDesc*, _ForwardIterator = audiere::FileFormatDesc*]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\vector.tcc|286|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::_M_fill_insert(__gnu_cxx::__normal_iterator&lt;typename _Alloc::pointer, std::vector&lt;_Tp, _Alloc&gt; &gt;, size_t, const _Tp&) [with _Tp = audiere::FileFormatDesc, _Alloc = std::allocator&lt;audiere::FileFormatDesc&gt;]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_vector.h|612|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::insert(__gnu_cxx::__normal_iterator&lt;typename _Alloc::pointer, std::vector&lt;_Tp, _Alloc&gt; &gt;, size_t, const _Tp&) [with _Tp = audiere::FileFormatDesc, _Alloc = std::allocator&lt;audiere::FileFormatDesc&gt;]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_vector.h|398|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::resize(size_t, const _Tp&) [with _Tp = audiere::FileFormatDesc, _Alloc = std::allocator&lt;audiere::FileFormatDesc&gt;]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_vector.h|412|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::resize(size_t) [with _Tp = audiere::FileFormatDesc, _Alloc = std::allocator&lt;audiere::FileFormatDesc&gt;]'|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|1174|instantiated from here|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_construct.h|81|error: no matching function for call to `operator new(unsigned int, void*)'|||note: candidates are: void* operator new(unsigned int)|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_construct.h||In function `void std::_Construct(_T1*, const _T2&) [with _T1 = audiere::AudioDeviceDesc, _T2 = audiere::AudioDeviceDesc]':|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h|86|instantiated from `_ForwardIterator std::__uninitialized_copy_aux(_InputIterator, _InputIterator, _ForwardIterator, __false_type) [with _InputIterator = audiere::AudioDeviceDesc*, _ForwardIterator = audiere::AudioDeviceDesc*]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_uninitialized.h|112|instantiated from `_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = audiere::AudioDeviceDesc*, _ForwardIterator = audiere::AudioDeviceDesc*]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\vector.tcc|286|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::_M_fill_insert(__gnu_cxx::__normal_iterator&lt;typename _Alloc::pointer, std::vector&lt;_Tp, _Alloc&gt; &gt;, size_t, const _Tp&) [with _Tp = audiere::AudioDeviceDesc, _Alloc = std::allocator&lt;audiere::AudioDeviceDesc&gt;]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_vector.h|612|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::insert(__gnu_cxx::__normal_iterator&lt;typename _Alloc::pointer, std::vector&lt;_Tp, _Alloc&gt; &gt;, size_t, const _Tp&) [with _Tp = audiere::AudioDeviceDesc, _Alloc = std::allocator&lt;audiere::AudioDeviceDesc&gt;]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_vector.h|398|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::resize(size_t, const _Tp&) [with _Tp = audiere::AudioDeviceDesc, _Alloc = std::allocator&lt;audiere::AudioDeviceDesc&gt;]'|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_vector.h|412|instantiated from `void std::vector&lt;_Tp, _Alloc&gt;::resize(size_t) [with _Tp = audiere::AudioDeviceDesc, _Alloc = std::allocator&lt;audiere::AudioDeviceDesc&gt;]'|I:\CodeBlocks\MinGW\include\Audiere\include\audiere.h|1199|instantiated from here|C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\include\c++\3.4.5\bits\stl_construct.h|81|error: no matching function for call to `operator new(unsigned int, void*)'|||note: candidates are: void* operator new(unsigned int)|||=== Build finished: 19 errors, 12 warnings ===|I think it has something to do with me including files or something. My main file includes #include <cstdlib>#include <SDL.h>#include <SDL_image.h>#include "main.h"#include "characters.h"#include <audiere.h>My characters.cpp file includes#include <SDL.h>#include <SDL_image.h>#include "main.h"#include "characters.h"Any ideas on how to fix this? If I take out any of the files, then I'll have to redefine things like screen and that will probably cause more errors along the way.[Edited by - evolutional on June 21, 2009 5:06:18 PM]
  Can we see the code for the headers?  My guess is that you have an error in your headers (like maybe a missing ';' or ')') that screws up the compiler so that it when it tries to parse the other headers you're including, that one error is screwing everything up.  One time I forgot to put a ';' on one line and got about 350 errors, and I don't think any of them were pointing to or complaining about the line the ';' was missing so it took a little bit to find it.  Anyway, my guess is you have a syntax error in your header(s) that's causing a parsing problem for the compiler.   ;  Whoa. Thanks. I didn't even see it heh. I had a function with only one (. Anyway... now I have an error saying that I need a proper constructor before a period ( SDL_Rect ).I:\The Legacy of Aexidos and Traxhord\characters.cpp|6|error: expected constructor, destructor, or type conversion before '.' token|I:\The Legacy of Aexidos and Traxhord\characters.cpp|7|error: expected constructor, destructor, or type conversion before '.' token|I:\The Legacy of Aexidos and Traxhord\characters.cpp|8|error: expected constructor, destructor, or type conversion before '.' token|I:\The Legacy of Aexidos and Traxhord\characters.cpp|9|error: expected constructor, destructor, or type conversion before '.' token|||=== Build finished: 4 errors, 0 warnings ===|-Characters.h-#ifndef _CHARACTERS_#define _CHARACTERS_#include <SDL.h>SDL_Surface *aexidos;const int AEXI_WIDTH = 27, AEXI_HEIGHT = 27;SDL_Rect AexiClip;int dir=1;/**    1 = DOWN    2 = UP    3 = LEFT    4 = RIGHT    5 = DOWN-LEFT    6 = DOWN-RIGHT    7 = UP-LEFT    8 = UP-RIGHT*/int AexiX,AexiY,AexiFrame,AexiVelocity;void AnimateAexidos();void SetAexidosFrame( int Frame );#endif // _CHARACTERS_-Characters.cpp-#include <SDL.h>#include <SDL_image.h>#include "main.h"#include "characters.h"AexiClip.x = (AEXI_WIDTH * AexiFrame);AexiClip.y = (AEXI_HEIGHT * dir);AexiClip.w = AEXI_WIDTH;AexiClip.h = AEXI_HEIGHT;void AnimateAexidos(){    SDL_Rect Aexioff;    Aexioff.x = AexiX;    Aexioff.y = AexiY;    SDL_BlitSurface(aexidos,&AexiClip,screen,&Aexioff);    /** Adding Map Scrolling Soon **/    /*camera.x = ( x + DOT_WIDTH / 2 ) - SCREEN_WIDTH / 2;    camera.y = ( y + DOT_HEIGHT / 2 ) - SCREEN_HEIGHT / 2;    if( camera.x < 0 )    {   camera.x = 0;    }    if( camera.y < 0 )    {   camera.y = 0;    }    if( camera.x > LEVEL_WIDTH - camera.w )    {   camera.x = LEVEL_WIDTH - camera.w;    }    if( camera.y > LEVEL_HEIGHT - camera.h )    {   camera.y = LEVEL_HEIGHT - camera.h;    }*/};  You really shouldn't define variables inside header files, because that means that each cpp file which includes it will have its own copy of the variable.  Use extern if you want to make global variables.You can't have assignment statements like this: AexiClip.x = (AEXI_WIDTH * AexiFrame);outside a function.  Initialization statements where you declare the variable and initialize it are ok (like int x = 4;).  But this is not an initialization statement.   ;  Alright. I've fixed just about everything, but now, while linking I get:Linking executable: bin\Release\The Legacy of Aexidos and Traxhord.exeobj\Release\characters.o:characters.cpp:(.bss+0x20): multiple definition of `_traxhord'obj\Release\main.o:main.cpp:(.bss+0x60): first defined hereobj\Release\characters.o:characters.cpp:(.bss+0x60): multiple definition of `_marshtomp'obj\Release\main.o:main.cpp:(.bss+0xa0): first defined hereobj\Release\characters.o:characters.cpp:(.bss+0x9c): multiple definition of `_aexidos'obj\Release\main.o:main.cpp:(.bss+0xdc): first defined hereobj\Release\characters.o:characters.cpp:(.bss+0xa0): multiple definition of `_screen'obj\Release\main.o:main.cpp:(.bss+0xe0): first defined herecollect2: ld returned 1 exit statusProcess terminated with status 1 (0 minutes, 3 seconds)0 errors, 12 warnings-main.h-#ifndef MAIN_H_#define MAIN_H_#include <SDL.h>SDL_Surface* screen;SDL_Surface* aexidos, marshtomp, traxhord;void loadimages();void newgame();void gameplay();void game();void splash();void lose();void pass();void win();void Ckeypress();#endif // MAIN_H_-characters.h-#ifndef _CHARACTERS_#define _CHARACTERS_#include <SDL.h>/**    1 = DOWN    2 = UP    3 = LEFT    4 = RIGHT    5 = DOWN-LEFT    6 = DOWN-RIGHT    7 = UP-LEFT    8 = UP-RIGHT*/void AnimateAexidos();void SetAexidosFrame( int Frame );#endif // _CHARACTERS_I declared and initialized all variables in the respective .cpp files.   ;Quote:Original post by CHG-SwampertI declared and initialized all variables in the respective .cpp files.No you didn't.  You declared traxhord, marshtomp, aexidos, and screen in your header main.h.  Remember, header files are not compiled, but rather when a source file (.cpp) #includes them, they are literally copied into the source file.  This means that when characters.cpp and main.cpp #include "main.h", they literally copy the contents of main.h into themselves (where the #include statement is), meaning that they each have their own traxhord, marshtomp, aexidos, and screen variables.  main.cpp and characters.cpp do not share these variables; each one has its own set of variables with the same identifiers.You should move these variable declarations into a source file to avoid the linker errors.  If you define them in one file source file (let's say main.cpp), but want to access them in a different source file (let's say characters.cpp), you have to use the extern keyword in the variables' declarations in characters.cpp.  A simple way to do this is to make the variables extern that you have in main.h, and then in one (and only one!) of the source files you give those variables an actual definition (i.e. just declare them normally without the extern keyword).   ;  EDIT:: You mean like intialize the variables in main.cpp then say extern SDL_Surface *aexidos;in characters.cpp?I'll keep looking on how to use the keywordEDIT:: Completely Fixed. Thanks for your help, mates![Edited by - CHG-Swampert on June 22, 2009 7:11:19 PM]