版本:SDL-1.2.15
转自,遇到的问题与此一样:http://blog.csdn.net/huierlc/article/details/50165237
问题1:make时出现 fatal error: X11/extensions/XShm.h: No such file or directory(已由较多相同答案)
安装相应的X11软件
sudo apt-get install x11proto-xext-dev
sudo apt-get install libxext-dev
问题2:
./src/video/x11/SDL_x11sym.h:168:17: error: conflicting types for _XData32?
SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
^
./src/video/x11/SDL_x11dyn.c:95:5: note: in definition of macro 釹DL_X11_SYM?
rc fn params { ret p##fn args ; }
^
In file included from ./src/video/x11/SDL_x11dyn.h:34:0,
from ./src/video/x11/SDL_x11dyn.c:26:
/usr/include/X11/Xlibint.h:568:12: note: previous declaration of 鈅XData32?was here
extern int _XData32(
^
make: *** [build/SDL_x11dyn.lo] Error 1
解决方案:查阅了一些资料,发现是libx11-dev版本问题(查看版本如图),版本>1.5.99,所以需要修改src/video/x11/SDL_x11sym.h 文件,按照提示修改168行,
修改如下:
原来是:SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
改后添加一个单词即可:(_Xconst)
SDL_X11_SYM(int,_XData32,(Display *dpy,register _Xconst long *data,unsigned len),(dpy,data,len),return)
再make 和 sudo make install就可以了。