[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:2012 Rules applicable to message 3406:

Rule-8.6  (Required) An identifier with external linkage shall have exactly one external definition


See also:

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