[previous] 3406 [next] Object/function '%s', with external linkage, has been defined in a header file.
Declarations and definitions

An object or function with external linkage has been defined inside an include file. Header files usually contain macro definitions and declarations of typedefs, tags, objects and functions with external linkage. Conventionally, a header file is included in multiple translation units because its primary function is to provide a way of using such items throughout a project without code duplication.

An object or function with external linkage should be defined in one translation unit only. It follows that such definitions should not be present in a header file except in the unusual situation where the header file is to be included in just one translation unit.


MISRA-C:2004 Rules applicable to message 3406:

Rule  8.5  (Required) There shall be no definitions of objects or functions in a header file.


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