GCC Debugging/Draft
New content \ idea test page
Posssible Book Guidelines
editAbout the book \ What is "GCC Debugging"
- Goals:
- verbose, easy to understand, manual
- cover troubleshooting with GCC
- make removing bugs a less painful \ time consuming process
- Intended audience:
- new gcc users with some experience in programming language being used
- Style:
- common language (not overly technical)
- Book Scope:
- gcc
- g++
- gdb
- other compilers?
Error and Warning pages should include:
- Verbose explanation of error message
- GCC Version(s) found in
- Earlier Versions of messages?
- Sample code that would cause the message to be displayed
- Fixes to get rid of trouble message (depending on cause)
Error Page Layout 1
editNotes on bottom, error causes are level 3 headings under level 2, "causes"
Page Title... ==Causes== ===<Possible Error Cause>=== <syntaxhighlight lang="cpp"> // source code producing error </syntaxhighlight> ''' Solutions''' What to change... <syntaxhighlight lang="cpp"> // source code fixing error </syntaxhighlight> ==Notes== *Message found in gcc versions x.x.x to x.x.x <noinclude>{{displaytitle|title=Full Error Message}}</noinclude> {{BookCat}}
example:
Page Title...
Causes
editArguments in a function call do not match those in any function declaration
editFor example, a function, "foo", is called from inside main with an argument that is not a perfect match for any of the currently existing implementations of "foo".
void foo(int x);
void foo(double x);
int main () {
long x = 5000;
foo(x);
...
Solutions
Cast the argument to match a declaration
int main () {
long x = 5000;
foo((int)x);
Create a new, overloaded version of the called function to match the arguments
void foo(int x);
void foo(double x);
void foo(long x);
int main () {
long x = 5000;
foo(x);
The same function is defined more then once
edit- Look for a misspelled or duplicate function definition/declaration
Notes
edit- Message found in gcc version 4.5.1
Error Page Layout 2
editNotes on top, causes are level 2 headings instead of 3
Page Title... example of error message <!-- Make below an info box? --> '''Found in:''' gcc versions x.x.x to x.x.x '''Past Versions:''' <!-- If there are any --> example of error message '''Found in:''' gcc versions x.x.x to x.x.x '''See Also:''' similar error messages? '''Causes:''' ==<Possible Error Cause>== <syntaxhighlight lang="cpp"> // source code producing error </syntaxhighlight> '''Solutions''' What to change... <syntaxhighlight lang="cpp"> // source code fixing error </syntaxhighlight> <noinclude>{{displaytitle|title=Full Error Message}}</noinclude> {{BookCat}}
example:
Page Title...
foo.cpp:23:12 call of overloaded 'foo' is ambiguous
- Found in: gcc versions x.x.x to 4.5.1
- Causes:
Arguments in a function call do not match those in any function declaration
editFor example, a function, "foo", is called from inside main with an argument that is not a perfect match for any of the currently existing implementations of "foo".
void foo(int x);
void foo(double x);
int main () {
long x = 5000;
foo(x);
...
Solutions
Cast the argument to match a declaration
int main () {
long x = 5000;
foo((int)x);
Create a new, overloaded version of the called function to match the arguments
void foo(int x);
void foo(double x);
void foo(long x);
int main () {
long x = 5000;
foo(x);
The same function is defined more then once
edit- Look for a misspelled or duplicate function definition/declaration