Oh Yeah.....
So how do I set it up?
Printable View
Below are links to a short movie (recorded on a test VM; quality should be acceptable) that illustrates one of the methods that I was talking about.
You may also need VMware's Movie Decoder if you don't have one of their products installed.
Hopefully you'll be able to do this on your own from now on...
Debugger.7z (~700 kB)
http://plasmator.t35.com/DebuggerSFX.zip (Can't link this one, retarded host) [7-zip Self-Extracting Archive] (~800 kB)
Thanks plasmator, really helpful :)
I really don't know which window shows what the problem is. This is the registers window;
and this is from output:Code:EAX = 00079D40 EBX = 00079B30 ECX = 00079D18 EDX = 00000000 ESI = 0178743C EDI = 0007A7BB EIP = 00000000
ESP = 00A9FE40 EBP = 00000000 EFL = 00200202
Does anyone know wha that could mean, in relation to the code at the start?Code:First-chance exception at 0x00000000 in orbiter.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00000000 in orbiter.exe: 0xC0000005: Access violation reading location 0x00000000.
You are accessing an address via pointer for reading, and that address you're attempting to access is NULL (0x00000000).
Set a breakpoint on the very first line of your application, and keep your eye on the Output Window. If that message hasn't appeared when the first line is about to execute, single step through the program until that message appears. When that message appears, then that area of code is where it's triggering that message.
Usually reading from a NULL address isn't fatal, but irritating seeing that message. The fatal one is when you attempt to write to a NULL address.
If that message appears before the first line in your main() program, then either you have global classes, objects, that were instantiated, and that is the cause of the problem, or if you're using other DLL's that get loaded at app startup, then they could be the ones causing the problem. You need to just debug slowly to pinpoint where that message is being generated from.
BTW, since you are using Visual C++, you should have posted this in either the Visual C++ forum (if using MFC) or the Windows API forum (if you're using straight Windows API calls).
Regards,
Paul McKenzie
Thanks for the help. I already know that this is the code causing the CTD:
So, I suppose I have to assign it to something. Any suggestions? :)Code:DLLCLBK void opcPreStep(double simt, double simdt, double mjd)
{
//loop through all weapons, and destroy them.
for (vector<Weapon>::iterator it = WeaponList.begin(); it != WeaponList.end();++it)
{
it->explode();
}
}
EDIT: Could this be it? it is in the Weapon class constructor.
Code://add self to WeaponList vector.
WeaponList.push_back(*this);
There are several lines posted there. Which one is it that is causing the problem?
As others pointed out, we need to see the full context of when, where, and how that code is called, we do not know what the values of any of those variables are when that code is called, etc.
Since this is a runtime issue, we can't do static analysis of source code to show you what you're doing wrong. All we can say is that the loop syntactically is correct. If WeaponList is valid, and if explode() has no issues, then that code is correct (Note the if -- only you know whether any of those things are valid or not).
Regards,
Paul McKenzie
I only get an error when I use a function of the iterator (it, using Weapon class functions).
How do I make a class push back itself on construction? I'm sure that's the problem.
Then that loop would never execute if the WeaponList is empty. Look at the for loop constraints. Second, if that loop did execute, that means that the WeaponList is not empty, and one of the item's in that list has an explode() function that is buggy, or the item itself is buggy.
I don't understand your question. How would that fix the issue I stated above?Quote:
How do I make a class push back itself on construction?
Hopefully you are not guessing at what the problem is. You never should guess, you have to actually debug, find the cause of the problem, and then offer a diagnosis to fix the problem.Quote:
I'm sure that's the problem.
Regards,
Paul McKenzie