开发者

Including header file with global variable

开发者 https://www.devze.com 2022-12-09 03:58 出处:网络
I need to include a header file that contains some global variables (not mine so I cannot 开发者_如何学Pythonchange it).

I need to include a header file that contains some global variables (not mine so I cannot 开发者_如何学Pythonchange it).

How do I do this so that the variables within the included file are considered 'extern' in all but one case?


You cannot. Copy the header and add extern yourself.


If the variables are only declared in the header, but aren't assigned a value, then you might be able to do this, depending on the compiler. GCC, for example, has the -fno-common flag to control this behavior.

0

精彩评论

暂无评论...
验证码 换一张
取 消