You’re trying to initialize the video portion of SDL where there is no video capabilities. You can either remove SDL_INIT_VIDEO, or you’ll need to change SDL_INIT_EVERYTHING to the initialization flags but without SDL_INIT_VIDEO.
well there is , SDL is working fine in the GUI mode , but as soon as I run the code in terminal mode , it gives error. If my system didn’t had the video displaying capabilities , why it would have run perfectly in the first scenario itself ??
why would i do that, I am using SDL for that specific purpose only, to render onto the screen.
Terminal mode does not have a GUI at all. When you’re using a desktop manager, (Cinnamon, MATE, KDE, GNOME, Unity, etc.), either X11, mir, or wayland is running in the background allowing graphics to be used. When you switch to the terminal, you’re leaving the graphics portion completely. You’re basically saying, “Why can’t I watch a video on my book?” Since you’re only using SDL for video, you don’t need it then; and can ignore the error, but you won’t be able to use any SDL calls to any of the video routines either.
Found what I was looking for: Is anyone using DirectFB?
It’ll probably work the same as any normal program, but will work in the terminal. You’ll need to reconfigure your cmake to enable the framebuffer option, VIDEO_DIRECTFB, then recompile your SDL2 library.