# GCC Debugging/g++/Errors
## abstract declarator 'TYPE' used as declaration

* Message found in GCC version 4.5.1
** often grouped together with:
*** member 'DATA_MEMBER' with constructor not allowed in anonymous aggregate
*** member 'DATA_MEMBER' with destructor not allowed in anonymous aggregate
*** member 'DATA_MEMBER' with copy assignment operator not allowed in anonymous aggregate
* a class or struct is missing a name:
* a header file has a class or struct with a name already used inside ifndef, define statements

## 'VARIABLE' cannot be used as a function

* Message found in GCC version 4.5.1
* make sure the variable name does not have an underscore in it (compiler weirdness)
* you're using the same name for a variable name and a function inside a function definition

## conversion from 'TYPE' to non-scalar type 'TYPE' requested

* Message found in GCC version 4.5.1
* type conversion error, look for missing "::" syntax or missing parenthesis
* possibly a casting error
* a class member function returns a value that does not match the function's declared return type

## could not convert 'STATEMENT' to 'bool'

* Message found in GCC versions 3.2.3, 4.5.1
* you a mistyped comparison operator (e.g., using: "=" instead of "==")
* you used an incorrect return type for the called function's definition
* you're using an invalid argument for a conditional statement

## declaration of 'FUNCTION' outside of class is not definition

* Message found in GCC versions 3.2.3, 4.5.1
* try using '=' to initialize a value instead of parenthesis
* you used a semicolon or comma between a constructor and an initializer list instead of a colon
* you left a semicolon before the body of a function definition

## declaration of 'VARIABLE' shadows a parameter

* Message found in GCC versions 3.2.3, 4.5.1
* you're redefining a variable name that's already in use, possibly declared in the function's parameter list

## 'TYPE' does not name a type

* Message found in GCC version 4.5.1
** in GCC version 3.2.3 sometimes reported as: syntax error before 'CHARACTER' token
** in GCC version 4.0.1, sometimes reported as: ISO C++ forbids declaration
*** e.g.: ISO C++ forbids declaration of 'vector' with no type
* you left out an object's name qualifier or using directive
* make sure you didn't mistype the scope operator "::", e.g.: "name:name" instead of "name::name"
* make sure you included the required libraries
* a header file is listed after a file that makes use of it in the include directives

## expected 'TOKEN' before 'TOKEN' token

* Message found in GCC versions 3.2.3, 4.5.1
** in GCC version 3.2.3 sometimes reported as: syntax error before 'CHARACTER' token
* check for a missing comma or parenthesis in a function's parameters
* check for a missing semicolon
** e.g.: expected ',' or ';' before 'TOKEN'
* possibly from a double namespace definition, or a fully-qualified (e.g., std::cout) name already under a 'using' directive
* possible missing '<<' or '>>' operator in a cin/cout statement

## expected primary-expression before 'TOKEN'

    expected primary-expression before 'int'
* Message found in GCC version 4.5.1
** in GCC version 3.2.3 reported as: parse error before ')' token
* one likely cause is using (or leaving in) a type name in a function call

## expected unqualified-id before

* Message found in GCC version 4.5.1
* check your syntax for missing, misplaced, or erroneous characters
* expected unqualified-id before '(' token
** e.g.: parentheses in a class name
* expected unqualified-id before 'return'
** e.g.: missing opening brace in a conditional statement

## incompatible types in assignment of 'TYPE' to 'TYPE'

* Message found in GCC versions 4.5.1
* you're trying to assign to or initialize a character array using a character pointer
** e.g.: incompatible types in assignment of 'const char*' to 'char [10]'
* improperly accessing elements of a 2D array

## invalid conversion from 'TYPE' to 'TYPE'

* Message found in GCC versions 3.2.3, 4.5.1
* make sure parentheses were not left out of a function name
* make sure you are passing a function the correct arguments

## invalid operands of types 'TYPE' and 'TYPE' to binary 'FUNCTION'

* Message found in GCC version 4.5.1
* You're trying to concatenate to C string arguments with the addition operator

## invalid use of template-name

    invalid use of template-name 'TEMPLATE' without an argument list
* Message found in GCC version 4.5.1
** often paired with: expected unqualified-id before 'TOKEN'
** in GCC version 3.2.3 reported as: syntax error before 'CHARACTER' token
* the type is missing after the class name in a function definition

## is not a member of

* Message found in GCC versions 4.5.1
* check for a missing header include
    example: 'cout' is not a member of 'std'

## 'TYPE' is not a type

* Message found in GCC version 4.5.1
** in GCC version 3.2.3 reported as: type specifier omitted for parameter 'PARAMETER'
* you mistyped a template parameter in a function declaration
* an included header file does not have the correct libraries included in the source file to implement it:
** e.g.: you're using #include "bar.h" without including the "foo.h" that "bar.h" needs to work
* Check that there are no methods with the same name as 'TYPE'.

## 'CLASS_MEMBER' is private within this context

* Message found in GCC versions 3.2.3, 4.5.1
* usually reported in the format:
** (LOCATION_OF_PRIVATE_DATA_MEMBER) error: 'DATA_MEMBER' is private
** (LOCATION_OF_CODE_ACCESSING_PRIVATE_DATA) error: within this context
* Message usually results from trying to access a private data member of a class or struct outside that class's or struct's definition
* Make sure a friend member function name is not misspelled
* make sure a read only function is using a 'const' argument type for the class
* make sure functions that alter data members are not const
* check for derived class constructors implicitly accessing private members of base classes
    solution 1: use an initializer list to bypass implicit initialization
    solution 2: make the accessed base class member protected instead of private
* You're trying to initialize a contained class member by accessing private data
possible fix, assign the whole object rather than part of it:

## ISO C++ forbids declaration of 'FUNCTION' with no type

* Message found in GCC version 3.2.3, 4.5.1
* you've created a function with no listed return type

## multiple definitions of

    eg: multiple definition of `main'
* Message found in GCC version 4.5.1
* check for missing inclusion guard in header file
* check for duplicate file listing in compile commands / makefile
** e.g.: g++ -o foo foo.cpp foo.cpp
* check for definitions rather than only declarations in the header file

## 'CLASS FUNCTION(ARGUMENTS)' must have an argument of class or enumerated type

* Message found in GCC versions 3.2.3, 4.5.1
* you're attempting to access members of a class with a non-member function
** non-member functions must access class members explicitly
    eg: CLASS_NAME FUNCTION_NAME(CLASS_NAME OBJECT_NAME, ARGUMENTS)
* you're redefining an operator for a standard (built-in) type

## new types may not be defined in a return type

* Message found in GCC version 4.5.1
** in GCC version 3.2.3, reported as:
       semicolon missing after definition of 'CLASS'
       ISO C++ forbids defining types within return type
* check for a missing semicolon at the end of a class definition

## no match for call to 'FUNCTION'

* Message found in GCC versions 3.2.3, 4.5.1
* make sure the function's namespace is used ( using namespace std / std::function )
* make sure the function name is not misspelled, parentheses aren't missing
* make sure the function is called with the correct arguments / types / class
* if you're initializing a variable via parentheses, if there's underscores in the variable name try removing them. Sometimes an equals sign is the only way...
* you're using the same name for a variable and a function within the same namespace

## no matching function for call to 'FUNCTION'

* Message found in GCC version 4.5.1
* make sure there aren't parentheses where there shouldn't be (e.g.: classname::value instead of classname::value )
* you're using a string argument with a function that expects a C-string

## non-constant 'VARIABLE' cannot be used as template argument

* Message found in GCC version 3.2.3
** in GCC version 4.5.1 reported as: 'VARIABLE' cannot appear in a constant-expression
* variable used for a template argument, which are required to be constant at compile time

## non-member function 'FUNCTION' cannot have cv-qualifier

    error: non-member function 'int Foo' cannot have cv-qualifier
       cv = constant / volatile
* Message found in GCC version 4.5.1
* you're using the 'post' const (constant value) on a non-member function
* you're not using the scope qualifier ("TYPENAME::") in the function definition
* you mistyped the definition for a template class's member function
possible fix:

## passing 'const OBJECT' as 'this' argument of 'FUNCTION' discards qualifiers

* Message found in GCC version 4.5.1
* you're returning an address
* you're attempting to access a container element with a const_iterator using a member function that has no non-const versions. The non-const function does not guarantee it will not alter the data

## request for member 'NAME' in 'NAME', which is of non-class type 'CLASS'

* Message found in GCC versions 4.5.1
** in GCC version 3.2.3 reported as:
       request for member 'NAME' in 'NAME', which is of non-aggregate type 'TYPE'
* check the function call in the code, it might be calling a function with incorrect arguments or it might have misplaced/missing parenthesis
* your using the "*this" pointer where you should just be using the functions name
* e.g., use: return mem_func; instead of: return *this.mem_func;
* using the "*this" pointer with the wrong syntax

## statement cannot resolve address of overloaded function

* Message found in GCC versions 3.2.3, 4.5.1
* make sure you're not forgetting the parenthesis after a member function name

## two or more data types in declaration of 'NAME'

* Message found in GCC version 4.5.1
** in GCC version 3.2.3 reported as: extraneous 'TYPE' ignored
* you have multiple data types listed for a function declaration's return value
* possibly a missing semicolon in between 2 type declarations
** usually missing in a function, struct, or class declaration after the curly braces

## <GOBBLEDEGOOK> undefined reference to <GOBBLEDEGOOK>

* Message found in GCC version 4.5.1
** in GCC versions 4.0.1, 4.2.1 reported as: Undefined symbols
* check for a missing or mistyped header includes
* check for a missing or mistyped files/libraries in a project/make file
* check for a missing, mistyped, or undefined functions or class constructors
* check for function declarations that do not match their definitions
* make sure function names do not overlap those in existing header files
* make sure compile commands syntax / makefile structure is correct (e.g.: g++ -o file.cc ... etc.)
* no main function is defined in any of the files inside a project/makefile
** e.g.: undefined reference to `WinMain@16'

## 'NAME' was not declared in this scope

* Message found in GCC version 4.5.1
** in GCC versions 3.2.3 reported as: 'FUNCTION' undeclared (first use of this function)
* look for a misspelled or changed variable/function/header call name
* make sure the proper header and library files are included
** defined variables may need the headers they utilize included in all files that use the defined variables