int main (int argc, char *argv[])
{
return 0;
}
Still, the error occurred. I tried running it through a debugger, and I didn't really get anything (Stupid Dev-C++...). Does anybody know why this might happen?
Odd problem...
I have an odd problem. I'm writing a simple RTS game for 4e4, and every time my game quits, it causes an access violation. I tried commenting out my entire main file, so that I was left with this:
Even with that tiny stub of a main function, global variables are still constructed and destroyed.
...it could be something weird like not rebooting your machine in a long time.
Just for fun try main() without any parameters, and also try with void as return type; see if these make any difference.
Just for fun try main() without any parameters, and also try with void as return type; see if these make any difference.
Also, try stepping through the code (I realize it's just one line), and when the crash occurs see the stack-trace. Perhaps you will see more information.
1. I removed all #include<> commands as well, so it can't be from that.
2. I'll try main() without any parameters, but since I'm using C++ I may get an error from declaring it void instead of int. And I reboot my machine every night (it boots up rather quickly, it's a laptop so it has to). Also, the error happens on every computer that I test it on.
3. I know that the error occurs when I return from the function. If I omit that, it may fix it, but then again I'll probably get errors and warnings. I'll try that, though.
2. I'll try main() without any parameters, but since I'm using C++ I may get an error from declaring it void instead of int. And I reboot my machine every night (it boots up rather quickly, it's a laptop so it has to). Also, the error happens on every computer that I test it on.
3. I know that the error occurs when I return from the function. If I omit that, it may fix it, but then again I'll probably get errors and warnings. I'll try that, though.
So a destructor of a global variable is failing. I hope you didn't think that removing the includes would disable the instantiation of global variables defined in other translation units?
It can't be globals, because I only have 5 globals in my program, and they're all integers. The main objects are all created in main().
I seriously doubt this will help. But try only having this in your
command line (for testing purposes)
See if it gives you that error then.
command line (for testing purposes)
int main(void){ return(0);}
See if it gives you that error then.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement