Thread: Why Does My Program Crash?

  1. #16
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Yes seriously allegro is a very good graphics lib.
    I love it and it works well.
    As for some comments on the orig code I would use more of a common resoultion eg 640 X 480 or even 800 X 600 which I use for my games. Other than that don't listen to the ramblings of c+Noob as he obvisously is what his name implies
    Last edited by prog-bman; 09-29-2005 at 04:43 PM.
    Woop?

  2. #17
    C++ Newbie
    Join Date
    Aug 2005
    Posts
    55
    I would normally use a resolution like that, but the idea of this game was to have it be a "coffe break" game. I wanted it to be a small game in a small window. Any idea why it's crashing when it reaches that line?

  3. #18
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    begin() + size() is one past the end. Maybe you meant begin() + size() - 1?

  4. #19
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Why are you cleaning up like that anyways why not let the vector destructor do its job?
    Woop?

  5. #20
    C++ Newbie
    Join Date
    Aug 2005
    Posts
    55
    Yep, that fixed it! Thanks! Vector destructor?

  6. #21
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> Vector destructor?

    The //Cleanup loop (not the code that caused the error) is not necessary. When the vector goes out of scope (as the program ends) the destructor is called and the elements inside are "erased" automatically. Besides, that code doesn't work the way you want it to anyway since the size of the vector changes every time you erase an element.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. char vs int - program crash!!
    By Goldrak in forum C++ Programming
    Replies: 4
    Last Post: 04-07-2006, 08:17 PM
  2. My program causes my compiler to crash
    By carolsue2 in forum C++ Programming
    Replies: 4
    Last Post: 04-06-2006, 04:06 AM
  3. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  4. sprintf() giving crash to program!!
    By maven in forum C Programming
    Replies: 4
    Last Post: 01-01-2006, 12:26 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM