If your program throws an error at runtime, the problem is much more likely to be in your code than in the compiler switches you're using. With that said, there are much more significant differences between the two compiler invocations than -c
. In particular, the differences are
-fexceptions -march=corei7 -g
If you add those compile switches to your command-line invocation, as with
g++-4.8 -fexceptions -march=corei7 -g -O3 -pedantic-errors -std=c++11
-Wextra -Wall -pthread main.cpp -o main
you can recompile your code and see that it probably still crashes. Find out where by stepping through your code using the debugger of your choice, since the -g
flag tells the compiler to include debugging information into the generated object file.