读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


相关文章:

  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
  • 2021-12-30
  • 2021-11-06
  • 2022-12-23
相关资源
相似解决方案