[previous] 1509 [next] 'name' has external linkage and has multiple definitions.
CMA undefined

More than one definition has been found of this object or function. If an identifier with external linkage is used but there does not exist exactly one external definition in the program for the identifier, behaviour is undefined. Notice that this is true whether the definitions are compatible or not.

In a linkable program, only one definition of a function or object is allowed.

Example:

void foo(int)
{
}

void foo(int)     // ERROR: foo is defined twice
{
}

Where the second definition occurs in a different translation unit, the compiler will not be able to warn about the duplicate definition, so a Cross Module or linker check is required to detect such duplicates.

Example:

// TU1
void foo(int)
{
}

// TU2
void foo(int)
{
}


MISRA-C:2004 Rules applicable to message 1509:

Rule  1.2  (Required) No reliance shall be placed on undefined or unspecified behaviour.
Rule  8.9  (Required) An identifier with external linkage shall have exactly one external definition.


See also:

QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents