malloc: *** error: incorrect checksum for freed object – object was probably modified after being freed

I have a big problem with my iOS App: it crashes sometimes without detailed debug error. The stack trace is empty. These are the only two lines in the stack trace: crash start in UIApplicationMain at “symbol stub for: -[_UIHostedTextServiceSession dismissTextServiceAnimated:]”. and report “libsystem_c.dylib`malloc_error_break”. in com.apple.main-thread. The error on Xcode debugger (with connected device): I … Read more

“No such file or directory” error in CodeBlocks

Got it finally: In my case, the problem resulted from a program called EGCS (Experimental/Enhanced GNU Compiler System). I installed it as a prerequisite for PSCAD(Power Systems CAD) along with a FORTRAN Compiler. Just remove it, and you’ll be fine.(Sadly, I deleted the entire PATH environmental variable due to a mistake. So what?…I ended up … Read more

How to prevent multiple definitions in C?

You actually compile the source code of test.c twice: The first time when compiling test.c itself, The second time when compiling main.c which includes all the test.c source. What you need in your main.c in order to use the test() function is a simple declaration, not its definition. This is achieved by including a test.h … Read more

Memory Clobbering Error

You are incrementing ptr, therefore changing the address that it points to. You can’t do that. In your case, have a separate pointer, let’s say char * p = ptr and do your operations with p leaving ptr intact so you can free(ptr) later. EDIT Taking a second look at your code, I found that … Read more

Debug vs Release in CMake

With CMake, it’s generally recommended to do an “out of source” build. Create your CMakeLists.txt in the root of your project. Then from the root of your project: And for Debug (again from the root of your project): Release / Debug will add the appropriate flags for your compiler. There are also RelWithDebInfo and MinSizeRel build configurations. You can modify/add to the flags by specifying a toolchain file in … Read more