The first file
//external. CPP -- -- external variables
//the compile with support. CPP
#include
using namespace std;
//external variable
Double warming=0.3;//warming defined
//function as
Void the update (double dt);
Void local ();
Int main ()
{
cout <"Global warming is" & lt;The update (0.1);
cout <"Global warming is" & lt;Local ();
cout <"Global warming is" & lt;return 0;
}
The second file
//support. The CPP -- -- use external variable
//the compile with external. CPP
#include
Extern double warming;//use warming form another file
//function as
Void the update (double dt);
Void local ();
Using STD: : cout;
Void the update (double dt)
{
Extern double warming;//optional redeclaration
Warming +=dt;//USES global warming
cout <"Updating global warming to" & lt;cout <"Degrees. \ n";
}
Void local ()
{
Double warming=0.8;
cout <"Local warming=" & lt;cout <"But global warming=" & lt; <: : warming & lt; <"Degrees. \ n";
}
Compilation is not through, this problem!!!!!!
Still need to debug after
C: \ Users \ wulc1 \ AppData \ Local \ Temp \ cczMrAQE o: function In ` main ':
F:/git/9.5 _external. CPP: 14: undefined reference to ` update (double)
'F:/git/9.5 _external. CPP: 16: undefined reference to ` local ()
'Collect2. Exe: error: ld returned 1 exit status
Pray god guide!!!!!!