Skip to main content
GameDev.net gamedev.net
🔒 Locked

Would it be acceptable if I programmed a game for XP, Vista, 7, and 8 to spare for Windows 10? Are these Windows versions still widely used today?

Started by rjhwinner03 Jul 10, 2018 at 6:56 PM 30 replies 7.9k views
Original Post
rjhwinner03
rjhwinner03

I am trying to program a RTS game, and the only barrier that is keeping me from completing it is an error that says



Debug Assertion Failed.

C:\Program files(x86)\microsoft visual studio 9.0\vc\include\vector

Line:251

Expression: Vector iterators incompatible.

For information on how your program can cause an assertion failure, see Visual C++ documentation on asserts.


I have tried to find the incompatible vectors, but it doesnt tell me where they are...


LorenzoGatti
LorenzoGatti
  • Post your failing code, there are many different ways to get this sort of error and appropriate fixes vary.
  • You need to look for any place in your code where std::vector iterators are used. You should be able to exclude a large portion of those calls because they can only happen before or after the failure.

By the way, Visual Studio 9 is ancient. Can you use a contemporary compiler? Why do you care for Windows XP and Vista?


Omae Wa Mou Shindeiru
rjhwinner03
rjhwinner03

I care about XP and Vista because they can run Visual Studio 2003, the compiler that I know the most.

SkyPenguin
SkyPenguin

making games for operating systems that no longer receive security upgrades isn't a gr8 idea.
XP at least is still widely used but typically at businesses, business that would look poorly on employees that played games on them.

ChaosEngine
ChaosEngine
27 minutes ago, rjhwinner03 said:

I care about XP and Vista because they can run Visual Studio 2003, the compiler that I know the most.

To be blunt, it's been 15 years... get a new compiler. C++ has moved on significantly since 2003 and the Visual Studio compilers are much better now.

You can get Visual Studio 2017 community edition for free, and it will be far more standards compliant.

As far as XP, Vista, etc goes, XP support ended 4 years ago, Vista support ended last year. 7 and 8 are technically still supported OSs, and 7 in particular is still quite popular in Asia and Africa. It's difficult to get hard numbers, but the Steam Hardware Survey is pretty representative. So XP accounts for less than 0.5% of users and Vista doesn't even register.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight
Oberon_Command
Oberon_Command

The error indicates that the iterators are incompatible. Perhaps you're trying to erase an element that is in one vector from a completely different vector, without realizing it?

Hard to say without code...

You should also be able to break in the debugger at the point of the assertion. Then you can look up the call stack to see where the issue is in your code.

rjhwinner03
rjhwinner03

The error brings me to stdthrow.cpp on the " ::_CrtDbgBreak();" function...

Oberon_Command
Oberon_Command
4 minutes ago, rjhwinner03 said:

The error brings me to stdthrow.cpp on the " ::_CrtDbgBreak();" function...

Yes, and what is farther up the callstack?

rjhwinner03
rjhwinner03

What do you mean?

Actually, from the looks of things, it appears to be a particle system that is giving errors... I am making a RTS game and I have a magician that shoots projectiles... Those are fireballs which are just particles grouped together. Whenever the particles hit the ground and scatter, it gives me that error I was mentioning in the first post...

Did this help any?

Oberon_Command
Oberon_Command

https://en.wikipedia.org/wiki/Call_stack

When you call a function, your program jumps to another place in the code. When a function completes, it needs to "return" to the place in the program where it was called from. To get back to the place in the code that called the function, it needs to store that information somewhere. You can think of that as a "stack" of function return addresses. Each time a function calls another one, another entry is put on the call stack.

When you're debugging a program, Visual Studio should have a tab somewhere that shows what functions are on that callstack. If I have a a program that calls a function called Foo, which calls a function called Frobnicate, which calls a function called YourMom, then if you put a breakpoint in YourMom, Visual Studio should show you something like this when the breakpoint is hit:

  • YourMom
  • Frobnicate
  • Foo
  • main

Note that the most recently called function is on the top, while the functions that called it are beneath it.

The idea of a call stack is really fundamental, so make sure you get this idea good and internalized. So fundamental, in fact, that if you didn't know what it was before, then I suggest this thread should have been put in the For Beginners section.

If you're having trouble with the actual tools, then I suggest heading to the GDNet Discord chat or some Visual Studio-specific resource.

0r0d
0r0d
12 minutes ago, rjhwinner03 said:

What do you mean?

He means look in the callstack and work your way up through the function calls until you find the function in your code that you're calling that has the problem.

Also, it's time to get a newer compiler.

rjhwinner03
rjhwinner03

I cant... I get Windows SDK errors when I try to build, forcing me to stick with VS 2008.

Oberon_Command
Oberon_Command
23 minutes ago, rjhwinner03 said:

What do you mean?

Actually, from the looks of things, it appears to be a particle system that is giving errors... I am making a RTS game and I have a magician that shoots projectiles... Those are fireballs which are just particles grouped together. Whenever the particles hit the ground and scatter, it gives me that error I was mentioning in the first post...

 Did this help any?

No, not at all. I know nothing about how you've implemented any of this, other than apparently a vector is involved. Nobody here is psychic, you know. Without any code or at least an in-depth explanation of the code that is failing, there's very little we can do. :P

That being said, my clairvoyance says you should double check that you aren't invalidating your iterators by erasing elements from your vector while iterating through it, that being a very common mistake.

rjhwinner03
rjhwinner03

My game is based off the code from "Programming a RTS game with Direct3D" by Carl Granberg. (Chapter 16)

Eric Richards has it on github, you could probably find it via Google.

I would probably not have errors if Visual Studio 2003 was not such a jerk...

It always gives me errors when I try to install, and the one time I got it completely installed, the IDE GUI was not working...

Oberon_Command
Oberon_Command

That's not specific at all. Again, I'm not psychic. What I'm looking for is the actual place in your code where the assertion is being hit.

To get that, you'll need to do what I said earlier and attach the debugger, catch the assertion, then use Visual Studio's callstack window to see the top-most function on it that is in your code. Post that function on the forum and let's have a look at it. If you're having trouble with this very basic task, I again suggest you go to the chat so we can help you more directly than trying to guess how your VS is set up.

I'm also a little unimpressed that you expect us to go and search for the source code that your project is based on, then somehow psychically work out where the problem is and what you changed in that code to cause the problem, when what is actually needed here is for you to put some effort into using the tools available to you to get the relevant information at hand.

rjhwinner03
rjhwinner03

I got it with the Call Stack.


It is in msvcp90d.dll

here is the call stack.


> msvcp90d.dll!std::_Debug_message(const wchar_t * message=0x003d7cb8, const wchar_t * file=0x003d71f0, unsigned int line=251) Line 24 C++


game.exe!std::_Vector_const_iterator >::_Compat(const std::_Vector_const_iterator > & _Right=0x0bf19328 {m_pSrcBone=0x0bf15940 m_speed=3.0000000 m_length=-4.3160208e+008 ...}) Line 251 + 0x17 bytes C++


game.exe!std::_Vector_const_iterator >::operator==(const std::_Vector_const_iterator > & _Right=0x0bf19328 {m_pSrcBone=0x0bf15940 m_speed=3.0000000 m_length=-4.3160208e+008 ...}) Line 211 C++


game.exe!std::_Vector_const_iterator >::operator!=(const std::_Vector_const_iterator > & _Right=0x0bf19328 {m_pSrcBone=0x0bf15940 m_speed=3.0000000 m_length=-4.3160208e+008 ...}) Line 216 + 0xc bytes C++


game.exe!APPLICATION::Update(float deltaTime=0.0060000001) Line 355 + 0x72 bytes C++


game.exe!WinMain(HINSTANCE__ * hInstance=0x00350000, HINSTANCE__ * prevInstance=0x00000000, char * cmdLine=0x00c98c0a, int showCmd=1) Line 115 C++


game.exe!__tmainCRTStartup() Line 574 + 0x35 bytes C


game.exe!WinMainCRTStartup() Line 399 C

Oberon_Command
Oberon_Command

Okay. That callstack indicates that the assertion is being thrown in APPLICATION::Update - every other function above it is in standard library code. Why don't you post the code for that function here?

rjhwinner03
rjhwinner03

Yep, it leads directly to the effects (particle systems, etc)

So what does this mean?


P.S. thank you guys for telling me how to find the Call Stack!!!

ChaosEngine
ChaosEngine

@rjhwinner03 can I ask how much programming experience you have? I'm not trying to be mean, but based on the questions you're asking, it sounds like you're still very much at the beginner level. There's nothing wrong with that; we all had to start somewhere, but I'm thinking that this particular project (a 3D RTS) might be a bit ambitious for where you're at.

If you're still trying to understand fundamental programming concepts like a call stack, I would avoid doing anything with 3d graphics until you are more comfortable with whatever language you want to use.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight
rjhwinner03
rjhwinner03

I have been programming in C++ for 4 years, and with Java for 4 years... I started DirectX last October (in 2017). I know how to use DirectX (as I have read Frank Luna's DX9 and DX12 books).


I am just more familiar with Visual C++ 6, Visual Studio 2003(I am most comfortable with this one because I started out with it), and Watcom C/C++.

I can program in DirectX 12, but I just prefer not to due to the lack of documentation and the crappy "help" from Microsoft's documentation website...

@ChaosEngine, how much experience do you have?

@ChaosEngine, what do you think would be a good time to start a game? I have had more experience with the old Visual Studio 2003 compiler/IDE and Code::Blocks IDE than I have had with the newer VS 2008 - 2017... Sorry if I was sounding harsh.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.