| Summary: | SDL conflicts with stdint.h and shouldn't | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ellie <etc0de> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
See also here why forcing possibly incompatible standard type definitions onto the user might be a bad idea: http://www.gamedev.net/topic/531286-stdinth-and-library-conflicts/ It seems to be another problem actually: SDL includes <stdint.h> itself internally, and this then clashes with its own headers. Does it help you when I upload the stdint.h present on my system somewhere? The problem appears to be that you're using SDL_config_minimal.h, instead of a system-specific SDL_config.h, generated at build time by SDL's configure script. Where did these headers come from? --ryan. I simply did ./configure && make as usual on a git SDL 1.3, and then set the include dir to that SDL's include/ folder (gcc option). Then I simply did #include "SDL/SDL.h" in the application. When I had the include path previously set to that SDL's include/SDL instead of that SDL's include/ I got an include error, so I think it is indeed grabbing it from the right folder and not somewhere else (system headers or so). Was this issue resolved? I compiled against the unmodified latest hg version today and it seems to be gone. Well, maybe it was also an issue with Fedora's headers with a fix on their side... I am not sure if I am supposed to do this, but for the sake of a clean bugzilla and in the light of this bug being totally gone in my configuration where I initially saw it, I will put this bug as resolved. If that is something I shouldn't have done, please revert/reopen. I just ran into this again, and this time located the problem: /usr/include/stdint.h defines _STDINT_H But SDL_config_minimal.h checks only for _STDINT_H_. Fix: ---- Replace SDL_config_minimal.h:36 #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) with #if !defined(_STDINT_H_) && !defined(_STDINT_H) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
> Replace SDL_config_minimal.h:36
I'll fix this, but to be clear: you shouldn't be using SDL_config_minimal.h ... the configure script should have generated a very-detailed SDL_config.h that's specific to the features available on your machine...the "minimal" version is there as a fallback for systems that don't use configure.
If this was an accident, we should figure out why you ended up with the wrong SDL_config*.h header.
--ryan.
I used a freshly checked out SDL2 with only the RenderCopyEx patch applied of which I'm pretty sure it wouldn't touch any related things. Then I did configure and make and ended up with the given error. (In reply to comment #7) > Replace SDL_config_minimal.h:36 This now checks for _STDINT_H, as of hg changeset 2c2ebbcb1980. --ryan. (In reply to comment #9) > Then I did configure and make and ended up with the given error. The error was during the make step? --ryan. The compiler parsed the SDL.h include while compiling my application and then ended up with the given redefinition conflict traced back to SDL_config_minimal.h. It was during the make step of my application, not the one of SDL. That one went fine, only compiling my app afterwards failed. (In reply to comment #12) > It was during the make step of my application, not the one of SDL. That one > went fine, only compiling my app afterwards failed. And did you point your application directly at SDL's "include" directory, or the headers that were installed by "make install"? SDL_config.h is (over)written by the configure script, and if you built in a separate directory, the default one in SDL/include is not the right header. (However, this code has changed recently, so this could be our bug, too.) --ryan. I point it to SDL's include/ folder. I don't make install SDL, I only make it and I removed its .hg folder to avoid that error that tells me to build somewhere else to avoid changing my hg'ed headers. I recheckout for every new SDL revision I am interested in anyway, so I don't care for changed headers - I do not use that particular SDL2 copy for commits. Should I attach my SDL_config.h, the config.log or anything else?
This _should_ be fixed as of this changeset:
http://hg.libsdl.org/SDL/rev/5d6b7b9432d3
Please reopen if it's still broken for you.
Thanks!
--ryan.
|
SDL conflicts with stdint.h, and IMHO for being able to write sane programs that use stdint.h properly but also use SDL at times, it shouldn't. Example (on Fedora 16): In file included from /usr/lib/gcc/i686-redhat-linux/4.6.2/include/stdint.h:3:0, from /usr/include/inttypes.h:28, from sdl/include/SDL_stdinc.h:67, from sdl/include/SDL_main.h:25, from sdl/include/SDL.h:72, from graphics.c:24: /usr/include/stdint.h:129:23: error: conflicting types for ‘uintptr_t’ sdl/include/SDL_config_minimal.h:46:23: note: previous declaration of ‘uintptr_t’ was here I think SDL either should only internally define its standard stuff and offer it to the user only when not already available through stdint.h (or when the user wants to have it explicitely), or it should simply not conflict with the official standard header file stdint.h.