首页 新闻 赞助 找找看

关于SDL出现的错,希望路过的帮忙看看啊

0
悬赏园豆:10 [已关闭问题] 关闭于 2012-09-09 15:08

1>f:\2011第二学期\c编程语言\sdl\fontm\fontm\fontm.cpp(34) : error C2664: 'TTF_RenderUNICODE_Solid' : cannot convert parameter 2 from 'const wchar_t [3]' to 'const Uint16 *'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

为什么会有这样的提示?

SDL
半分微醉的主页 半分微醉 | 初学一级 | 园豆:60
提问于:2012-09-09 12:32
< >
分享
所有回答(1)
0

传错参数(类型不一致),具体得看代码。

向往-SONG | 园豆:4853 (老鸟四级) | 2012-09-09 12:41

extern SDL_Surface *gpChinese;

 gpChinese = TTF_RenderUNICODE_Solid( font, L"圣旨", RGB_Yellow);

就是这的代码出错了

applySurface(260,50,gpChinese,gpScreen);

void applySurface( int x, int y, SDL_Surface* source, SDL_Surface* destination )
{
 SDL_Rect dst;//目标表面的位置

 dst.x = x;
 dst.y = y;

 //将源表面传输到目标表面上
 SDL_BlitSurface( source, NULL, destination, &dst );
}

或者是这里

支持(0) 反对(0) 半分微醉 | 园豆:60 (初学一级) | 2012-09-09 13:09

@半分微醉: 

Uint16 a='圣旨';

gpChinese = TTF_RenderUNICODE_Solid( font, &a, RGB_Yellow);

试下这个。

支持(0) 反对(0) 向往-SONG | 园豆:4853 (老鸟四级) | 2012-09-09 13:28

@向往-SONG: 

f:\2011第二学期\c编程语言\sdl\fontm\fontm\fontm.cpp(22) : warning C4305: 'initializing' : truncation from 'int' to 'Uint16'
1>f:\2011第二学期\c编程语言\sdl\fontm\fontm\fontm.cpp(22) : warning C4309: 'initializing' : truncation of constant value
1>Linking...
1>fontM.obj : error LNK2001: unresolved external symbol "struct SDL_Surface * gpChinese" (?gpChinese@@3PAUSDL_Surface@@A)

出现了新的错误

支持(0) 反对(0) 半分微醉 | 园豆:60 (初学一级) | 2012-09-09 13:53

@半分微醉: 我知道问题所在了,但分不能给你

支持(0) 反对(0) 半分微醉 | 园豆:60 (初学一级) | 2012-09-09 15:07
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册