ousen
ousen

Reputation: 21

Getting errors when including sdl2/sdl_image.h

So my problem with SDL2 is the moment i include SDL2/SDL_image.h like this :

#include <SDL2/SDL_image.h>

Even without using any function of sdl_image, when i compile i get a lot of errors.

I get 3 types of errors:

conflicting types (exp: error conflicting types for 'SDL_ThreadPriority').

and redeclaration of enumerator (exp: error redeclaration of enumerator SDL_ASSERTION_ABORT).

And : redefinition of (exp: error redefinition of 'struct SDL_RWops').

I am on Linux and i am using the c language, i have tried compiling with gcc and mingw in codeblocks, i get the same errors.

I have SDL2_image installed and I linked it in the compilers.

Upvotes: 1

Views: 312

Answers (1)

ousen
ousen

Reputation: 21

OK guys i resolved my problem.

what caused the conflict was sdl2 being installed twice the first through package manager, and the second manually by compiling from source.

so i had two SDL2 directories one in: /usr/include and the second in: /usr/local/include.

when installed libsdl2-image-dev automatically through package manager, it was installed, in: /usr/include and not the later and thats what caused problems when i started using in in my programs. So all i had to do is uninstall the one in /usr/local/include and thats it.

Upvotes: 1

Related Questions