Stopping multiple #warning messages in header files

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Stopping multiple #warning messages in header files

跳至解决方案
1,287 次查看
CarlFST60L
Senior Contributor II

Hi,

 

I have some header files with #warnings, when I compile, the warning appears once for every source file which includes the header.

 

Is there a way to stop the warning being shown more than once?

 

Obviously #pragma once and #ifndef are all scope dependent, therefore, do not stop the repeat messages.

 

Carl.

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
891 次查看
CrasyCat
Specialist III

Hello

 

The compiler is processing one compilation unit (Source file + all files included in there) at a time.

So the warning will be generated each time you have the corresponding .h file included in a C file.

 

There is no way to print a warning only once during a full build.

 

CrasyCat

在原帖中查看解决方案

0 项奖励
回复
2 回复数
892 次查看
CrasyCat
Specialist III

Hello

 

The compiler is processing one compilation unit (Source file + all files included in there) at a time.

So the warning will be generated each time you have the corresponding .h file included in a C file.

 

There is no way to print a warning only once during a full build.

 

CrasyCat

0 项奖励
回复
891 次查看
CarlFST60L
Senior Contributor II

Thanks, I was thinking there may be some 'trick' that I wasnt aware of :smileyhappy:

0 项奖励
回复