undefined reference to `std::ios_base::Init::Init()’

You can resolve this in several ways: Use g++ in stead of gcc: g++ -g -o MatSim MatSim.cpp Add -lstdc++: gcc -g -o MatSim MatSim.cpp -lstdc++ Replace <string.h> by <string> This is a linker problem, not a compiler issue. The same problem is covered in the question iostream linker error – it explains what is … Read more

Core dump file analysis

You just need a binary (with debugging symbols included) that is identical to the one that generated the core dump file. Then you can run gdb path/to/the/binary path/to/the/core/dump/file to debug it. When it starts up, you can use bt (for backtrace) to get a stack trace from the time of the crash. In the backtrace, each function invocation is … Read more

double free or corruption (fasttop)

The problem is here: Basically, when you free temp2, you free first, not the memory allocated here: , which remains a memory leak, because after the assignment it can’t be freed anymore. Also, your code has probably some more problems (one is that you shouldn’t use fflush on an input stream), but without some more details, it’s … Read more

Floating point exception( core dump

You are getting Floating point exception because Number % i, when i is 0: Just start the loop at i = 2. Since i = 1 in Number % i it always be equal to zero, since Number is a int.