[an error occurred while processing this directive]
Node:GDB and C++ source,
Next:C++ classes in GDB,
Previous:Debug graphics,
Up:Debugging
.cc
sourceQ: When I try to debug my C++ programs, the debugger claims it can't
find the source file:
file.cc: No such file or directory.
The source file is there, but it's called
file.cpp
, not file.cc.
Why does this happen?
A: It's a bug in GCC 2.7.2.1 and earlier. It erroneously assumes
that a C++ source always has a .cc
extension. If you are using
GCC 2.7.2.1 or earlier, you'd better call your C++ files *.cc
.
If this is unacceptable, you can work around this bug by invoking
cc1plus
and the assembler pass manually. The bug in GCC
manifests itself in that cc1plus
is called with the option
-dumpbase file.cc.
If you replace this with
-dumpbase file.cpp
(or whatever your extension is), the
debugger will happily find your sources.
GCC 2.8.0 and later corrects this bug, so upgrading is also a solution.