linux c随手记
作者:互联网
1: 变量申明
重复include 了相同的文件会报 redefinition 错误
比如
==============
test.c
#include <stdio.h>
#include "test1.c"
#include "test2.c"
==============
test1.c
#include "test2.c"
==============
test2.c
int A=1;
====================================================================================
2: extern的使用
test.c
#include <stdio.h>
extern int A;
int main(){
printf("%d",A);
}
============
test1.c
int A=1;
============
编译gcc test.c test1.c
标签:test1,test2,随手,int,extern,linux,test,include 来源: https://www.cnblogs.com/bigmiao/p/15705819.html