MISRAC++2008-3-3-1
In this section:
Synopsis
(Required) Objects or functions with external linkage shall be declared in a header file.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
Externally linked objects shall be declared in a header file. This check is identical to MISRAC++2023-6.5.1.
Coding standards
- MISRA C++ 2023 6.5.1
(Advisory) A function or object with external linkage should be introduced in a header file
Code examples
The following code example fails the check and will give a warning:
void example(){}
The following code example passes the check and will not give a warning about this issue:
namespace {
void example(){}
}