| 12345678910111213141516171819202122232425262728293031 |
- A general C++ debugging guide for anyone who might need it.
- Cannot find method in namespace:
- * Check that the header is included from where it is called.
- * Check that the correct namespace is being used.
- * Check input arguments.
- Having the wrong input is like using another method name because of overloading.
- Linker error:
- * Check that the cpp file is compiled by looking at the cpp files being mentioned in the terminal.
- If not compiled:
- * Check that the file's name doesn't contain spaces by mistake.
- * Check that it's in a folder being compiled.
- * Check that the definition in the cpp file has the identifier declared explicitly in the namespace.
- flags returnType namespace::methodName( ... ) flags { ... }
- Multiple definitions of method in header:
- * Move to cpp implementation which is only compiled once or declare as inline.
- Cannot move variable to base class without getting weird behaviour:
- * Did the construction of the variable in the list depend on a variable given to the class that it moved to?
- Calling a base constructor will not set any of the variables before all of them are complete.
- Calls to a class crashes when done from another source file.
- * Make sure that each method is implemented in the corresponding source file.
- A class fully defined in the header may have contradicting implementations between the sources that include the header.
- General rules:
- * If a class isn't supposed to be instanciated, make it abstract by letting at least one virtual method be pure.
- This reveals if any polymorph argument is passed as a template type to overloading, which ignores the child type and its v-table.
|