hi!
i was just doing some coding and i have a very serious problem. my app crashes randomly. i even found the problem, but i dont know the hell why?!
i created a class called vector2d because i dont want to create 2 floats all the time (its not an irrlicht app, sdl+opengl). now when i pass it to functions like this for example: "doSomething(vector2d(0.0, 0.0));" the app crashes with a segmentation fault. when i do a "doSometing(new vector2d(0.0, 0.0));" and use vector2d as a pointer it does not crash. but thats a real ugly solution!!
now comes the best part:
when i use solution1 the app does not crash all the time. from 10 times i start it the app works (!!!) 1 time, so i dont know whats causing this.
the best thing is that i have another visual c++ project with the same classes and nearly the same code but it does not crash (i have another problem there lol, from 10 times i start the app i have 8 times no lighting, thats strange))
does someone of you can give me a hint what could cause the problem? or how such an error is caused, because i cant even search for solutions when i dont know what the hell is going on :/
ps: this is driving me crazy lol
this is so f*****g annoying!!!!
wrong o.O""" i just pasted the event code back in and it still works, lol? how is that possible? its the exact same code but it works? i dont get it
edit: could a damaged system memory cause that? i had that *strange* problems a while ago with another code too and when i exchanged the names "armor" with "armor2" it worked o.O
edit: could a damaged system memory cause that? i had that *strange* problems a while ago with another code too and when i exchanged the names "armor" with "armor2" it worked o.O
no i deleted all files (Debug and Release folders) before so that is not possible.
now, i tried for a few hours to "break" it again (yes, i actually tried to do that ) but its not possible. seems that it works now.
but for no reason. imagine this:
int add(int num1, int num2)
{
num1+num2;
return num1;
}
when i would do "add(1,2);" it would crash. now i just copy&paste that code to another location/rename the variables, and it works. (this was just an example) - very weird. i really think that this is a problem with my computer because otherwise i can not explain why it happens.
but it works now so i dont care anymore back to coding!
ps: i think i love opengl, its so much fun to learn things about it hehe
now, i tried for a few hours to "break" it again (yes, i actually tried to do that ) but its not possible. seems that it works now.
but for no reason. imagine this:
int add(int num1, int num2)
{
num1+num2;
return num1;
}
when i would do "add(1,2);" it would crash. now i just copy&paste that code to another location/rename the variables, and it works. (this was just an example) - very weird. i really think that this is a problem with my computer because otherwise i can not explain why it happens.
but it works now so i dont care anymore back to coding!
ps: i think i love opengl, its so much fun to learn things about it hehe
thanks man! that could be really possible, since these problems only happen when i use visualc++ , i never had such problems with codeblocks or devc++Anonymous wrote:If you are using VS2003, then you need to do a periodic
"Clean" from the menu and rebuild. VS2003 is bad about
corrupting code as well. Don't just delete the debug or release
files, choose clean from the dropdown menu. And always make a
back-up copy of the project when using VS2003.
I've never had that problem with Visual Studio. One time, we thought VIsual Studio was screwed up, because it would skip files we just checked out. But it turns out, our source control was putting timestamps on the files from the time they were modified before they were checked in, so when you check a file out at say 2PM, but it was checked in with a modification time stamp of 8AM, it got an 8AM time stamp on checkout, not 2PM. Anyways, the only weirdness I ever see in VS.NET 2003 is internal compiler errors, and if you just build again, everything is ok( and this only happens to me on our projects at work, which have over 2 million lines of code )