【发布时间】:2011-11-25 04:49:30
【问题描述】:
如何处理来自 PC Lint 的警告?
我在几个文件中有#include <GenericTypeDefs.h>。 PC Lint 向我显示消息 Warning 537: Repeated include file 'filepath\filename.h' 如果我删除此声明,我将无法编译。
如果可能,我想取消此警告。
您可以看到相同的报告here。
这是我的代码,我的编译器会为此发出警告:
checksum.h
#ifndef CHECKSUM_H
#define CHECKSUM_H
#include <GenericTypeDefs.h>
BOOL isCheckSumCorrect(const UINT8 *dataPointer, UINT8 len, UINT8 checkSumByte);
#ifdef __cplusplus
extern "C" {
#endif
cryptography.h
#ifndef CRYPTOGRAPHY_H
#define CRYPTOGRAPHY_H
#include <GenericTypeDefs.h>
UINT8 encrypt(UINT8 c);
UINT8 decrypt(UINT8 c);
#ifdef __cplusplus
extern "C" {
#endif
crc8.h
#ifndef CRC_H
#define CRC_H
#include <GenericTypeDefs.h>
UINT8 generateCRC(const UINT8 *ptr, UINT8 Len);
BOOL isCRCValid(const UINT8 *ptr, UINT8 Len, UINT8 CRCChar);
#ifdef __cplusplus
extern "C" {
#endif
显然,我没有在checksum.c、cryptography.c 和crc8.c 上重复#include <GenericTypeDefs.h>
【问题讨论】:
-
显示代码,没有它试图回答是没有用的。
-
@Griwes,我已经链接了一个关于相同问题的示例。
-
您是否尝试过按照帖子中的建议进行操作?在 #include 文件之前检查标头保护,即在 crc.h 中,您将执行 #ifndef generictypes_h #include
#endif。这是重复的努力,但它可能是唯一的方法。 -
在计算世界的背景下,我的大脑无法将任何“爱丽丝”想象成一个真实的人。
-
@TomalakGeret'kal 你是对的。我删除此信息