SDL 2.0 won't initialize. Error: “Failed to connect to the Mir Server”

前端 未结 3 1331
春和景丽
春和景丽 2021-01-20 04:17

I am running Ubuntu 14.04, and using Eclipse CDT.

In my program, I am trying to initialize SDL and if it doesn\'t initialize then output the error, but SDL_GetError(

3条回答
  •  没有蜡笔的小新
    2021-01-20 04:52

    Does the environment you are running on have a windowing system?
    This error has come up for me when I'm running tests initializing SDL2 on Travis CI using Ubuntu 14.04. Based on what I've been able to gather from further testing and hints I've gotten from google searches SDL_Init when initializing SDL if it is passed SDL_INIT_VIDEO (which you are doing implicitly with SDL_INIT_EVERYTHING), it will try and connect with the windowing system of your machine.
    So perhaps try:

    SDL_Init(0)
    

    and then initialize the other subsystems later with:

    SDL_InitSubSystem(SDL_INIT_EVERYTHING)
    

    If you do keep in mind that you must quit every subsystem you initialize in this case it's just technically. You would do that like this:

    SDL_QuitSubSystem(SDL_INIT_EVERYTHING)
    

提交回复
热议问题