读ini文件“GetPrivateProfile*”: error C2664:cannot convert parameter 1 from 'const char [12]' to 'LPCWS

读ini文件——“GetPrivateProfileIntW”: 不能将参数 1 从“const char [9]

用GetPrivateProfileInt读取ini配置文件:

std::string iniPath;

test = GetPrivateProfileInt("Performance", "Type", 0, iniPath.c_str());

总是出错:

error C2664: 'GetPrivateProfileIntW' : cannot convert parameter 1 from 'const char [12]' to 'LPCWSTR'


解决办法:

选中项目,右键选择属性——>配置属性——>常规——>项目默认值——>字符集,选为“使用多字节字符集"——>应用——>确定。

重新编译,可以发现错误已消除。

读ini文件“GetPrivateProfile*”: error C2664:cannot convert parameter 1 from 'const char [12]' to 'LPCWS

读ini文件“GetPrivateProfile*”: error C2664:cannot convert parameter 1 from 'const char [12]' to 'LPCWS