Sorry, I ignore the response request suggesting nothing but the use of header files. Headers are needed for this when you use them correctly ... Read carefully:
global.h
#ifndef MY_GLOBALS_H #define MY_GLOBALS_H
global.cpp
#include "global.h"
user.cpp
Now that you are compiling and linking your project, you should:
- Compile each source file (.cpp) into an object file;
- Link all the object files to create an executable / library / independently.
Using the syntax above, you should have neither compilation nor error references.
paddy source share