Debugging Symbols Lost When Linking?
I'm trying to compile a program with debugging symbols so that valgrind will give me line numbers. I have found that if I compile a simple test program in one go (with -g) then it contains the symbols. However, if I compile in two passes (i.e. compile then link) then it does not contain the debugging symbols. Here's the compile command for the single pass case: g++ -g file.c -o file And for two passes g++ -g -c file.c -o file.o g++ -g file.o -o file The actual program looks like this and contains a simple Invalid Write int main(){ int* x = new int[10]; x[10]=1; } If I compile with one pass