Common Coding Bugs
From enfascination
(→C++) |
(→C++) |
||
Line 13: | Line 13: | ||
/usr/libexec/gcc/path/ld: multiple definitions of symbol | /usr/libexec/gcc/path/ld: multiple definitions of symbol | ||
− | |||
*If there are too many copies of a file name in the makefile. | *If there are too many copies of a file name in the makefile. | ||
+ | *Or some other Makefile problem | ||
020walker.cpp:311: error: a function-definition is not allowed here before '{' token | 020walker.cpp:311: error: a function-definition is not allowed here before '{' token | ||
Line 29: | Line 29: | ||
*forgot parens on a function | *forgot parens on a function | ||
+ | error: 'string' does not name a type | ||
+ | *forgot "using namespace std;" | ||
Lots more: | Lots more: | ||
[[http://www.comp.leeds.ac.uk/hannah/cpp/errors.html]] | [[http://www.comp.leeds.ac.uk/hannah/cpp/errors.html]] |
Revision as of 21:20, 4 July 2009
Note: these diagnoses will tend towards being too narrow, and may have solutions that are more general
C++
/usr/libexec/gcc/PATH/4.0.1/ld: Undefined symbols: Something collect2: ld returned 1 exit status make: *** [program] Error 1
- if it is for a whole class, it could mean that in an abstract class, I didn't set a function declaration to 0
- if it is for a specific static field, it could mean that I forgot "ClassName::" on initializing it
- if a function is declared from another file but that file isn't included
- or forgot to comile the cpp file in make
/usr/libexec/gcc/path/ld: multiple definitions of symbol
- If there are too many copies of a file name in the makefile.
- Or some other Makefile problem
020walker.cpp:311: error: a function-definition is not allowed here before '{' token 020walker.cpp:332: error: expected `}' at end of input
- Missing closing curly bracket on an if-statement
error: expected unqualified-id before 'using'
- forgot closing bracket on class definition
error: expected constructor, destructor, or type conversion before '&' token
- forgot to include header file on .cpp file
error: invalid use of member (did you forget the '&' ?)
- forgot parens on a function
error: 'string' does not name a type
- forgot "using namespace std;"
Lots more: [[1]]