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

问题描述 投票:-1回答:1

我正在尝试从这里的旧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;
}
c gcc
1个回答
0
投票

在第41,51,55,59行的/>中,教程代码中有杂散的HTML。这些必须在GCC成功构建之前删除。感谢tkausl建议的解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.