开发环境:ubuntu12.04
交叉编译工具: arm-none -linux-guneabi-gcc
目前遇到要在开发板上使用的应用程序,需要用到SDL库。单独安装SDL包,即使用sudo apt-get install libsdl1.2-dev能正常安装,并能在ubuntu上使用gcc正常编译应用程序。后面参考网上的资料来移植SDL (即重新在网上下载一个SDL原码包来安装)
先配置:
......$: ./configure --disable-video-qtopia --disable-video-dummy --disable-video-fbcon --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-cdrom --disable-video-x11 --disable-nasm --target=arm-none-linux-gnueabi --host=arm-linux --enable-video-fbcon
没有报错
.......$: make
........$: make install
执行了上面两步也没有报错。并在usr/local/include/目录下能正常产生SDL目录,在usr/local/lib/目录下也能有相关的SDL动态链接等文件。以上的日期都是可以查询的为刚刚产生。
现在执行SDL解压包中的参考测试文件 testalpha.c
SDL-1.2.15/test$ arm-none-linux-gnueabi-gcc -o testalpha testalpha.c -l/usr/local/include/SDL/ -L/usr/local/lib/ -lSDL
则报错一堆,提示好像还是没有找到相关的SDL的头文件等(如下所示)。
testalpha.c:11:17: error: SDL.h: No such file or directory
testalpha.c:23: error: expected ')' before '*' token
testalpha.c:63: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
testalpha.c:150: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'flashes'
testalpha.c:151: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'flashtime'
testalpha.c:153: error: expected ')' before '*' token
testalpha.c:175: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
testalpha.c:176: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
testalpha.c:177: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'position'
testalpha.c:181: error: expected ')' before '*' token
testalpha.c:241: error: expected ')' before 'x'
testalpha.c:247: error: expected ')' before '*' token
testalpha.c:306: error: expected ')' before '*' token
testalpha.c: In function 'main':
testalpha.c:324: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
testalpha.c:324: error: 'info' undeclared (first use in this function)
testalpha.c:324: error: (Each undeclared identifier is reported only once
testalpha.c:324: error: for each function it appears in.)
testalpha.c:325: error: 'SDL_Surface' undeclared (first use in this function)
testalpha.c:325: error: 'screen' undeclared (first use in this function)
testalpha.c:327: error: 'Uint8' undeclared (first use in this function)
testalpha.c:327: error: expected ';' before 'video_bpp'
testalpha.c:328: error: 'Uint32' undeclared (first use in this function)
testalpha.c:328: error: expected ';' before 'videoflags'
testalpha.c:330: error: 'SDL_Event' undeclared (first use in this function)
testalpha.c:330: error: expected ';' before 'event'
testalpha.c:331: error: 'light' undeclared (first use in this function)
testalpha.c:333: error: expected ';' before 'ticks'
testalpha.c:337: error: 'SDL_INIT_VIDEO' undeclared (first use in this function)
testalpha.c:353: error: 'video_bpp' undeclared (first use in this function)
testalpha.c:358: error: 'videoflags' undeclared (first use in this function)
testalpha.c:358: error: 'SDL_SWSURFACE' undeclared (first use in this function)
testalpha.c:368: error: 'SDL_HWSURFACE' undeclared (first use in this function)
testalpha.c:371: error: 'SDL_HWPALETTE' undeclared (first use in this function)
testalpha.c:380: error: 'SDL_RESIZABLE' undeclared (first use in this function)
testalpha.c:383: error: 'SDL_NOFRAME' undeclared (first use in this function)
testalpha.c:386: error: 'SDL_FULLSCREEN' undeclared (first use in this function)
testalpha.c:422: error: 'SDL_DOUBLEBUF' undeclared (first use in this function)
testalpha.c:425: error: 'sprite' undeclared (first use in this function)
testalpha.c:433: error: 'SDL_HWACCEL' undeclared (first use in this function)
testalpha.c:440: error: 'SDL_Rect' undeclared (first use in this function)
testalpha.c:440: error: expected ';' before 'clip'
testalpha.c:441: error: 'clip' undeclared (first use in this function)
testalpha.c:449: error: 'lastticks' undeclared (first use in this function)
testalpha.c:462: error: 'ticks' undeclared (first use in this function)
testalpha.c:475: error: 'event' undeclared (first use in this function)
testalpha.c:477: error: 'SDL_VIDEORESIZE' undeclared (first use in this function)
testalpha.c:484: error: 'SDL_MOUSEMOTION' undeclared (first use in this function)
testalpha.c:491: error: 'SDL_MOUSEBUTTONDOWN' undeclared (first use in this function)
testalpha.c:497: error: expected ';' before 'area'
testalpha.c:499: error: 'area' undeclared (first use in this function)
testalpha.c:507: error: 'SDL_KEYDOWN' undeclared (first use in this function)
testalpha.c:512: error: 'SDLK_ESCAPE' un declared (first use in this function)
testalpha.c:514: error: 'SDLK_t' undeclared (first use in this function)
testalpha.c:527: error: 'SDL_QUIT' undeclared (first use in this function)
testalpha.c:537: error: 'backing' undeclared (first use in this function)
testalpha.c:540: error: 'flashes' undeclared (first use in this function)
testalpha.c:542: error: 'flashtime' undeclared (first use in this function)
这是什么问题呢?或者上面的方法就是错误的?可有其他的正确的办法? 望知者告知,万分多谢!!


hb881029 于 2013-12-17 11:44:24发表:
同时,去掉交叉编译,改成Gcc编译,还是有问题。
.....$: gcc -o testalpha testalpha.c -l/usr/local/include/SDL/ -L/usr/local/lib/ -lSDL
错误如下:
wu@wu-desktop:~/sdl/SDL-1.2.15/test$ wu@wu-desktop:~/sdl/SDL-1.2.15$
bash: wu@wu-desktop:~/sdl/SDL-1.2.15$: 没有那个文件或目录
依旧是找不到SDL的头文件,是不是SDL没有安装成功啊??