SDL_TTF标头给我带来麻烦
SDL_TTF header giving me trouble
在病毒迫使我重置为出厂状态后,我一直在尝试在我的计算机上设置SDL。用我的IDE CodeBlocks运行SDL很容易,但设置扩展库就不那么容易了。CodeBlocks可以识别库的存在,但在SDL_ttf标头和SDL_image标头中会出现多个错误。代码中给我带来麻烦的部分是:
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
第一行生成错误"error:字符串常量前应为非限定id",第三行生成上述错误和错误"error:行尾前应为'}'"。我的猜测是,这可能与SDL是用C编写有关,也许我的CodeBlocks没有被配置为识别C.
编辑:测试源代码如下:
SDL_Surface* imageBlitingFunctions::loadText(Uint8 red, Uint8 blue, Uint8 green, std::string fontname, int fontSize, std::string text)
{
SDL_Color textColor = {red, blue, green};
TTF_Font *font1 = TTF_OpenFont(fontname.c_str(), fontSize);
SDL_Surface *message1 = TTF_RenderText_Solid(font1, text.c_str(), textColor);
return message1;
}
解决了这个问题。显然,项目文件不知怎么被破坏了,所以我只是把脚本转移到另一个项目,一切都很好。
相关文章:
- 我已经阅读了很多关于 2d 数组的信息,但我在作业中使用它时遇到了麻烦
- 查找奇数平方和时遇到麻烦
- 将双倍转换为 LPARAM 的麻烦
- 麻烦得到提升::记录器编译
- 翻转 ppm 图像C++麻烦
- 尝试使用 indexOf 创建一个 if 语句来检查字符串是否包含字符.有一点麻烦
- 搬家turtlebot_gazebo麻烦
- CSUF EPP - 你有什么想法(在添加到链接列表末尾时遇到麻烦)
- 我的期末考试遇到了麻烦.代码不断循环回到我的订购菜单,不会显示我的总价
- 作为一个C++新手,我遇到了麻烦
- 我需要帮助创建一个评分系统,但它一直给我一个错误,注释掉的整数是给我带来麻烦的部分
- 找麻木的麻烦
- MySQL 从注入过渡到参数化时遇到麻烦
- 字符串和双精度的麻烦,等值后再得到一个数字
- C++击球平均值程序使用输入/输出文件打印名称,平均值,最高/最低平均值时遇到麻烦
- 自定义QVariant麻烦
- 串和阵列的麻烦
- 在C 向量中修改对象值的麻烦
- C DirectX 11从第二个顶点缓冲区呈现麻烦
- 如何访问 TTF 字体(不是 OTF)的 GDEF / GPOS / GSUB?