RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic  
View previous topic - View next topic  
Author Message
Captain Vimes
Grumble Teddy


Joined: 12 May 2006
Posts: 225
Location: The City Streets

PostPosted: Wed Aug 01, 2007 12:16 am    Post subject: Vector Problems [quote]

GRAHHHH

Sorry, just had to get that out of my system.
I'm doing the space invaders thing, and I keep getting this error whenever I compile (or something like it, I can't remember exactly and my laptop stopped working again so I can't check):

in (file included from vector.h) _M_begin is undefined, first use this function
_M_insert is undefined, first use this function
(rinse and repeat with various vector functions)

What the heck does this MEAN, people?! I realize *insert_vector_name_here*.insert() and everything are vector functions, but why is there an _M_ in front and why is it causing an error? I've used vectors before without any problem.

Any ideas? I've spent the past four days trying to fix this and various other errors, but they were all coding errors on my part and I've fixed them. I have no idea whether this has something to do with my code or not. If it does, let me know and I'll mess around until it works. If not, then how do I fix it?

Oh, something I just remembered too. I'm declaring my vectors like this:

vector<variable_type> m_vThingy;

and similar, and I've done that before, but this time it says "expected ';' before '<' token" or something like that. What's that mean, or is it the same problem as what's causing the above error?
_________________
"Sometimes it is better to light a flamethrower than to curse the darkness."
- Terry Pratchett
Back to top  
XMark
Guitar playin' black mage


Joined: 30 May 2002
Posts: 870
Location: New Westminster, BC, Canada

PostPosted: Wed Aug 01, 2007 1:33 am    Post subject: [quote]

I'm kind of out of practice with "real" programming (I'm just doing php at work, hehe) but it sounds like some sort of a casting problem. I think you're not putting exactly the right data type in so when it tries to call a compiler-generated version of the function (template?) for that data type, it doesn't find it.

Just a guess though, there's a fair chance that I'm wayyyy off the mark :)
_________________
Mark Hall
Abstract Productions
I PLAYS THE MUSIC THAT MAKES THE PEOPLES FALL DOWN!
Back to top  
Ninkazu
Demon Hunter


Joined: 08 Aug 2002
Posts: 945
Location: Location:

PostPosted: Wed Aug 01, 2007 1:53 am    Post subject: [quote]

Do you have the line
using namespace std;
in your code? If not you have to say std::vector instead of just vector.
Back to top  
Captain Vimes
Grumble Teddy


Joined: 12 May 2006
Posts: 225
Location: The City Streets

PostPosted: Sun Aug 26, 2007 10:00 pm    Post subject: [quote]

Okay:

@XMark: ...uh... what? I'm a n00b. Please speak n00b. Thanks.
@Ninkazu: yes, I do.

If it means anything, the Sprite* that I'm putting into the vector has SDL data types in it (SDL_Rect, SDL_Surface, etc.).
_________________
"Sometimes it is better to light a flamethrower than to curse the darkness."
- Terry Pratchett
Back to top  
etscrivner
Pretty, Pretty Fairy Princess


Joined: 30 Jun 2007
Posts: 9
Location: California

PostPosted: Sun Aug 26, 2007 11:21 pm    Post subject: [quote]

Are you including vector.h? If so you might try switching to include <vector> instead, vector.h on some compilers can work in unexpected ways.
Back to top  
Post new topic Reply to topic Page 1 of 1 All times are GMT
 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum