[SDL] Re: SDL and std::vector not mixing well...

Julian Peterson weaver at merold.net
Mon Nov 7 02:38:58 PST 2005


On Monday 07 November 2005 11:02 pm, Nick Stovall wrote:
> Rasmus Neckelmann <neckelmann <at> gmail.com> writes:
> > I'm using std::vector (and other STL stuff) extensively combined with
> > SDL, and have never experienced any problems with it.
> > Maybe it would be easier to help if you could post a minimal piece of
> > code that still produces the problem?
>
> vector<int> vec;
> ^This crashes the program at startup.
>

I'm guessing that your program has memory issues somewhere.  Check for 
double deletes, mixing new/delete malloc/free, buffer overruns, etc.

> vector<int> vec(10);
> ^this won't even compile... error C2059: syntax error : 'constant'
>

On what compiler?  Cause that's fine...
You might want to check the surrounding code.  For example, forgetting 
trailing semicolons after class declarations can produce weird errors on 
some compilers (though usually that's screens of random syntax errors).


> I just tested it, that code works in other SDL apps,
>  but not the one I need it to.
>

As Rasmus asked, can you provide a minimal code example that fails?


Julian.

-- 
If it smells it's chemistry, if it crawls it's biology, if it doesn't work
it's physics.





More information about the SDL mailing list