新人遇到困难,求解答!~跪谢!~
我用VS2008编译一个.cpp文件,出错
1>..\main_parts1p1.cpp(51) : error C2065: “FILE_MAP_ALL_ACCESS”: 未声明的标识符
1>..\main_parts1p1.cpp(51) : error C3861: “OpenFileMapping”: 找不到标识符
1>..\main_parts1p1.cpp(62) : error C2065: “FILE_MAP_ALL_ACCESS”: 未声明的标识符
1>..\main_parts1p1.cpp(61) : error C3861: “MapViewOfFile”: 找不到标识符
1>..\main_parts1p1.cpp(92) : error C2065: “MUTEX_ALL_ACCESS”: 未声明的标识符
原来在windows xp 系统的机子可以直接通过,现在换到win 7的机子就报错了,是不是跟系统有关啊?应该怎么改呢?求解答求解答~~~~
出错的源代码段如下
/*open map of the file*/
hMapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, // Read/write permission.
FALSE, // Do not inherit the name
TEXT("TEST_COMM_MappingObject")); // of the mapping object.
if (hMapFile == NULL)
{
return 0;//your code deal with the error.
}
//creat a mapview of the mapfile.
lpMapAddress = MapViewOfFile(hMapFile, // Handle to mapping object.
FILE_MAP_ALL_ACCESS, // Read/write permission.
0, // Max. object size.
0, // Size of hFile.
0); // Map entire file.