在VC2010中,无法使用loadimage

0
IMAGE background;//背景图

void initGame() //初始化游戏
{
	state=1;
	initgraph(WIDTH, HEIGHT);
	loadimage(&background, L"background.bmp", 100, 100, true);
}

在loadimage下方显示波浪线,提示 no instance of overloaded function “” matches the argument list.

我的graphics.h什么的都加了,

void initGame(); void showGame(); void ctolGame(); putimage(0, 0, &background);

这些都能正常用,EasyX 用的是最新版的。

报错内容:

1>c:\users\lenovo\documents\visual studio 2010\projects\pppvz\pppvz\pppvz.cpp(42): error C2665: 'loadimage' : none of the 2 overloads could convert all the argument types
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\easyx.h(264): could be 'void loadimage(IMAGE *,LPCTSTR,int,int,bool)'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\easyx.h(265): or 'void loadimage(IMAGE *,LPCTSTR,LPCTSTR,int,int,bool)'
1> while trying to match the argument list '(IMAGE *, const wchar_t [16], int, int, bool)'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
0

看样子你已经修改了系统字符集为 MBCS。

如果你要用 MBCS,就去掉字符串前面的 L。

如果你想在字符串前面加 L,就修改项目的字符集编码为 Unicode。

ava
慢羊羊

2020-2-16

万分感谢! -  Oo神奇椰果oO  2020-2-16
技术讨论社区