0
votes

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.

1
What else do you include? Please post a minimal reproducible example. - HolyBlackCat
Please give more details like: compiler messages, your code, you environment - codegorilla
i include stdio.h stdlib.h , SDL2/SDL.h, and SDL2/SDL_image.h - ousen
as for the environement its codeblocks and mingw. - ousen
i couldn't write the code here (i'm struggling with stackoverfolw) but its just the code for opening a window and drawing a rectangle. - ousen

1 Answers

0
votes

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.