views:

60

answers:

2

This has been stumping me for a bit. I have a Class written in C++. Everything works fine. Next, I add funtion void A(); to the header file and run, It still works fine.
However as soon as I add a new function definition to the CPP file, I get a runtime error every single time. (specifically: Process terminated with status -1073741510 (0 minutes, 7 seconds)
void ClassName::A() { }
I am running using Code::Blocks on Windows, also strange but the permissions of the output directory are all changed after the crash and the folders/files are all set to Read Only.
Note: there are NO references/uses of the function elsewhere in the code, only the definition. I am interested in what sort of bug could cause this kind of runtime error? Possibly a memory leak somewhere?
Thanks!

A: 

Sounds like you have a wild pointer somewhere.

Billy ONeal
I am messing with a lot of pointers, so I will go back and dig through the code a bit. Thanks.
KennyCason
+1  A: 

Usually such an error is the result of memory corruption somewhere in the program.

Kirill V. Lyadvinsky
Thanks, I was figuring as much. It just really caught my attention when it was caused by declaration of new and furthermore, unused function. Thanks.
KennyCason
@Kenny: If there is undefined behavior in your program, the compiler is allowed to do whatever it wants. Including be completely inconsistent. Memory corruption or wild pointers both count as undefined behavior.
Billy ONeal
Thanks I actually traced down a memory leak nested inside a for loop. I still get the error, but if I found one error than there are likely more :P
KennyCason