[SDL] Re: SDL and std::vector not mixing well...
nsto135 at aol.com
Mon Nov 7 10:43:09 PST 2005
Julian Peterson <weaver <at> merold.net> writes:
> 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?
Here you go, this is the entire header that I've declaired the vector in.
Replacing vector<int> m_vFrameTracker with vector<int> m_vFrameTracker( *number*
) doesn't do any good, it still crashes.
I just tested it, and declairing a vector in main() works just fine, the program
runs nicely and every. Declairing it as a member of a class is what's causing
I'm using VS.NET2003
More information about the SDL