#include <iostream>
#include "int.h"
using namespace std;
void F();
int main()
{
cout << a << endl;
F();
system("PAUSE");
return 0;
}
//other.cpp
#include <iostream>
#include "int.h"
using namespace std;
void F()
{
cout << a + 10 << endl;
}
//int.h
#ifndef __TEST2_H__
#define __TEST2_H__
int a = 10;
#endif
I''m using MinGW with GCC 3.2 and compile with the following:
g++ -o main *.cpp