main.cpp
#include <stdio.h>
#include <stdlib.h>
#include "gh.h"
int main()
{
printf("%d \n",a);
return 0;
}
fun.cpp
#include <stdio.h>
#include "./gh.h"
void fun2()
{
printf("a2:%d \n",a);
}
gh.h
#ifndef GH_H_
#define GH_H_
int a=0;
int b=1;
#endif
(只编译)没错误,但这该死的水印.