I\'m getting an error from the following code using C++.
Main.cpp
#include \"file.h\"
int main()
{
   int k = GetInteger();
   retu         
        
If everything is in the same translation unit it should work. You probably did not compile File.cpp into the same unit as Main.cpp.
g++ -Wall File.cpp Main.cpp
If each file is compiled separately the function must be made extern to be used from a
different translation unit.
extern int GetInteger();
which is the same as
int GetInteger();