How to install SDL2 library in Fedora 20

血红的双手。 提交于 2019-12-24 03:29:23

问题


There is a question about the SDL package (SDL 1.2) in Fedora in StackOverflow. But I can't found any about SDL2 in Fedora, and I am having troubles to install the SDL2 package.

I search and the command to install SDL2 in Fedora is:

sudo yum install SDL2*

But still having problems to found the #include "SDL2/SDL.h"..

After looking in usr/include/, I wasn't able to found the SDL.h...

So how can I install SDL2 package and make it work in Fedora 20 distro?


回答1:


  1. Make Sure to have SDL2 and development headers installed correctly.

    $ yum search SDL2 #look for libraries and development headers should something like sdl2.0 and sdl2.0.0-dev
    
  2. include SDL2 in sourcefile for example main.c

    #include "SDL2/SDL.h"
    
  3. and make sure to link SDL2 library with the compiler flag -lSDL2

    $ clang main.c -lSDL2 -o programName
    



回答2:


sudo yum install SDL2-devel

You can search packages here: https://apps.fedoraproject.org/packages/SDL2-devel/



来源:https://stackoverflow.com/questions/26494683/how-to-install-sdl2-library-in-fedora-20

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!