- 论坛徽章:
- 0
|
原帖由 blizzard213 于 2008-10-30 00:40 发表 ![]()
见4 5楼
你只需include即可
但必须在某c处定义一次
感谢以上各位的热心。
我修改了一下,const.h 以下已经是完整代码了。
extern const long BUF_LEN = 100; |
main.c注释掉了
- //extern const long BUF_LEN;
复制代码
编译结果。可以通过和运行,只是有warning,我想知道原因。
- In file included from main.c:1:
- const.h:2: warning: `BUF_LEN' initialized and declared `extern'
复制代码
gcc版本
- $gcc --version
- gcc (GCC) 3.4.6 (Gentoo Hardened 3.4.6-r2 p1.5, ssp-3.4.6-1.0, pie-8.7.10)
- Copyright (C) 2006 Free Software Foundation, Inc.
- This is free software; see the source for copying conditions. There is NO
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
复制代码 |
|