[previous] 3447 [next] '%s' is being declared with external linkage but this declaration is not in a header file.
Declarations and Definitions

An object or function is being declared with external linkage and the declaration is not located in a header file.

When an item has external linkage, it can usually be assumed that it will be accessed from more than one translation unit. In order to ensure consistency between definition and usage, it is conventional to implement a single declaration located in a header file and for the header file to be included in the translation unit where the item is defined as well as in every translation unit where the item is used.

Be aware that QA·C only recognises a file as being a header file when it is analysed via a #include statement. So, for example, message 3447 will be generated in a ".h" file if the file contains a declaration with external linkage and is analysed on its own.

For example:


/*PRQA S 2017,3211,3603 ++*/

extern int gv1 = 0;                      /* Message 3408 */

extern int gv2;                          /* Message 3447 */
int gv2 = 0;

extern void foo1(void)                   /* Message 3408 */
{
}

extern void foo2(void);                  /* Message 3447 */

extern void foo2(void)
{
}

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents