fork(1) download
  1. #include <iostream>
  2.  
  3. extern int i; // Only declaration
  4.  
  5. int func()
  6. {
  7. if (i)
  8. return i;
  9. else
  10. return -1;
  11. }
  12.  
  13. int main()
  14. {
  15. int ret = func();
  16. std::cout<<"Ret : "<<ret<<std::endl;
  17. }
Compilation error #stdin compilation error #stdout 0s 16064KB
stdin
Standard input is empty
compilation info
/home/R77EVE/ccd6n643.o: In function `func()':
prog.cpp:(.text+0x2): undefined reference to `i'
/home/R77EVE/ccd6n643.o: In function `main':
prog.cpp:(.text.startup+0x3): undefined reference to `i'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty