拥有构建良好的简单控制台应用程序:
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
#include <cstring>
如果我添加行(或(和)#include <string>
),它也会构建得很好
#include <cstring>
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
如果我gc.c
只添加一个包含行的文件,#include <cstring>
(或(和)#include <string>
),编译器会产生很多错误:
Error 2 error C2061: syntax error : identifier 'using' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 18 1 cstringerr
Error 43 error C2061: syntax error : identifier 'strxfrm' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 26 1 cstringerr
Error 41 error C2061: syntax error : identifier 'strtok' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 26 1 cstringerr
Error 39 error C2061: syntax error : identifier 'strstr' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 25 1 cstringerr
Error 37 error C2061: syntax error : identifier 'strspn' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 25 1 cstringerr
Error 35 error C2061: syntax error : identifier 'strrchr' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 25 1 cstringerr
Error 33 error C2061: syntax error : identifier 'strpbrk' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 24 1 cstringerr
Error 31 error C2061: syntax error : identifier 'strncpy' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 24 1 cstringerr
Error 29 error C2061: syntax error : identifier 'strncmp' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 24 1 cstringerr
Error 27 error C2061: syntax error : identifier 'strncat' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 23 1 cstringerr
Error 25 error C2061: syntax error : identifier 'strlen' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 23 1 cstringerr
Error 23 error C2061: syntax error : identifier 'strerror' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 23 1 cstringerr
Error 21 error C2061: syntax error : identifier 'strcspn' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 22 1 cstringerr
Error 19 error C2061: syntax error : identifier 'strcpy' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 22 1 cstringerr
Error 17 error C2061: syntax error : identifier 'strcoll' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 22 1 cstringerr
Error 15 error C2061: syntax error : identifier 'strcmp' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 21 1 cstringerr
Error 13 error C2061: syntax error : identifier 'strchr' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 21 1 cstringerr
Error 11 error C2061: syntax error : identifier 'strcat' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 21 1 cstringerr
Error 9 error C2061: syntax error : identifier 'memset' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 20 1 cstringerr
Error 7 error C2061: syntax error : identifier 'memmove' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 20 1 cstringerr
Error 5 error C2061: syntax error : identifier 'memcpy' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 20 1 cstringerr
Error 3 error C2061: syntax error : identifier 'memcmp' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 18 1 cstringerr
Error 4 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 18 1 cstringerr
Error 6 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 20 1 cstringerr
Error 8 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 20 1 cstringerr
Error 10 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 20 1 cstringerr
Error 12 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 21 1 cstringerr
Error 14 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 21 1 cstringerr
Error 16 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 21 1 cstringerr
Error 18 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 22 1 cstringerr
Error 20 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 22 1 cstringerr
Error 22 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 22 1 cstringerr
Error 24 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 23 1 cstringerr
Error 26 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 23 1 cstringerr
Error 28 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 23 1 cstringerr
Error 30 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 24 1 cstringerr
Error 32 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 24 1 cstringerr
Error 34 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 24 1 cstringerr
Error 36 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 25 1 cstringerr
Error 38 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 25 1 cstringerr
Error 40 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 25 1 cstringerr
Error 42 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 26 1 cstringerr
Error 44 error C2059: syntax error : ';' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 26 1 cstringerr
Error 1 error C2054: expected '(' to follow 'using' C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstring 18 1 cstringerr
看起来编译器不理解包含中存在的任何内容。
包含<cstring>
或<string>
附加 cpp 文件有什么问题?