is't neccessary to include "struct" keyword at this program?

1
2
3
4
5
6
//test.C
#include<csignal>
int main(){
sigaction a;//mark1
return 0;
}

it goes wrong when i type "g++ test.C" in terminal. but when i add "struction" on the ahead of marked line,it goes well.
I wonder if that is the problem of the "bad" include path.If not, i wonder if it's neccessary to include "struct" keyword on some C++ programs?
In C:
1
2
3
4
5
6
7
struct Foo {
  // members
};

int main(void) {
  struct Foo sample; // typename is "struct Foo"
}


In C++:
1
2
3
4
5
6
7
struct Foo {
  // members
};

int main(void) {
  Foo sample; // typename is "Foo" (but "struct Foo" is ok)
}

You are including a C++ header, but the compiler is possibly(?) compiling the source as C code.

I don't use GCC/MinGW command-line compiling so I could be mistaken. If the compiler is processing it as C code because of the file extension then using struct is required.
if its windows, it may not understand upper case C as filename case is not important. try .cpp instead?

Topic archived. No new replies allowed.