繁体   English   中英

从 SDL 教程构建示例程序时的 GCC 错误

[英]GCC Errors When Building Example Program From SDL Tutorial

我正在尝试从这里的旧 SDL 教程构建此示例程序 dots.c。 http://www.dreamincode.net/forums/topic/64143-game-programming-in-linux-for-windows-programmers-part-2/我从 GCC 收到错误,我认为这可能与缺少 C 有关我的复制粘贴或原始 HTML 表示省略了转义序列。 但我对 C 的了解不够,无法以一种或另一种方式说。 我想知道代码需要进行哪些更改才能清除这些构建错误,最好是了解您如何识别这些错误。 谢谢你。

dots.c:41:94: error: expected declaration specifiers before ‘/’ token
 void set_sdl_pixel(SDL_PixelFormat *what,void *pixel,int width,int x,int y,int r,int g,int B)/>
                                                                                              ^
dots.c:66:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
dots.c:91:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
dots.c:113:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
dots.c:132:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
dots.c:163:1: error: expected ‘{’ at end of input
 }
 ^

40-42

/* Sets a pixel in a surface, paying attention to pixel format */
void set_sdl_pixel(SDL_PixelFormat *what,void *pixel,int width,int x,int y,int r,int g,int B)/>
{

64-66

/* Draws things using direct access to the surface */
void draw_pixels(SDL_Surface *screen)
{

89-91

/* Initializes the game */
void game_init()
{

111-113

/* Processes everything in the game for a frame */
void game_main()
{

130-132

/* Main */
int main()
{

158-163

    }
    /* Exit SDL */
    SDL_Quit();
    /* Exit */
    return 0;
}

在教程代码中的第 41、51、55、59 行以 /> 的形式存在杂散的 HTML。在 GCC 成功构建之前必须删除这些。 感谢 tkausl 提出解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM