Errors in building C project in visual studio 2010
I have project lets say PROJECT in C. It contains a number of header files and source files. I build the project in following way
File->New->project from external files
I gave the location of the project files and Name of the project.
Choose the option as Console
and then finish
The project is seen in the solution bar
with
external dependencies, header and source file.
When I build it i get error in header file such as
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/_types.h(15): error C2054: expected '(' to fo开发者_StackOverflow中文版llow '__extension__'
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stddef.h(73): error C2085: '__threadid' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stddef.h(75): error C2085: '__threadhandle' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/_types.h(37): error C2085: '_flock_t' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/_types.h(40): error C2085: '_iconv_t' : not in formal parameter list
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/unistd.h(15): error C2082: redefinition of formal parameter '_environ'
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/unistd.h(17): error C2082: redefinition of formal parameter '_exit'
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\sys/unistd.h(19): error C2085: 'access' : not in formal parameter list
What can be the reason for it?
The __extension__
keyword is used by gcc to indicate that you know that something is an extension but want to use it anyway, and request the compiler not to warn about that.
http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
Seems like you include some header that is gcc specific and doesn't work for MSVC.
精彩评论