fork download
  1. //other file
  2. #include <iostream>
  3. using namespace std;
  4. struct A{
  5. void operator()(){cout << "A() called" << endl;}
  6. };
  7.  
  8. void fun(A a){
  9. a();
  10. }
  11.  
  12. //original file
  13. #include <iostream>
  14. using namespace std;
  15.  
  16. struct A;
  17.  
  18. void fun(A a);
  19.  
  20. struct A{
  21. void operator()(){cout << "A() called" << endl;}
  22. };
  23.  
  24. int main(){
  25. fun(A());
  26. return 0;
  27. }
  28.  
  29.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:20:8: error: redefinition of ‘struct A’
 struct A{
        ^
prog.cpp:4:8: error: previous definition of ‘struct A’
 struct A{
        ^
stdout
Standard output is empty