error C2099: initializer is not a constant

发布于 2020-05-05  47 次阅读


问题描述:

error C2065: ‘SM_MOUSEWHEELPRESENT’ : undeclared identifier

error C2099: initializer is not a constant

warning C4047: ‘initializing’ : ‘int ‘ differs in levels of indirection from ‘char [21]’

error C2065: ‘SM_XVIRTUALSCREEN’ : undeclared identifier

error C2099: initializer is not a constant

warning C4047: ‘initializing’ : ‘int ‘ differs in levels of indirection from ‘char [24]’

error C2065: ‘SM_YVIRTUALSCREEN’ : undeclared identifier

error C2099: initializer is not a constant

error C2065: ‘SM_CXVIRTUALSCREEN’ : undeclared identifier

error C2099: initializer is not a constant

warning C4047: ‘initializing’ : ‘int ‘ differs in levels of indirection from ‘char [19]’

error C2065: ‘SM_CYVIRTUALSCREEN’ : undeclared identifier

error C2099: initializer is not a constant

warning C4047: ‘initializing’ : ‘int ‘ differs in levels of indirection from ‘char [22]’

error C2065: ‘SM_CMONITORS’ : undeclared identifier

error C2099: initializer is not a constant

error C2065: ‘SM_SAMEDISPLAYFORMAT’ : undeclared identifier

error C2099: initializer is not a constant

warning C4047: ‘initializing’ : ‘int ‘ differs in levels of indirection from ‘char [21]’

Error executing cl.exe.


解决方法:

那些是WindowNT里才能使用的常量,它是是被条件编译的。

需要在的sysmets.cpp文件的最前面加一句

#define WINVER 0x0500


一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。