[英]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.