jun-zhang / msinttypes

Automatically exported from code.google.com/p/msinttypes
0 stars 0 forks source link

Compiler error when trying to compile a project using SDL and FFmpeg #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
--------------------------------------
Trying to compile the small program
#include "SDL.h"
extern "C"
{
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavutil/avutil.h"
}

void main(void)
{
  return;
}

What is the expected output? 
----------------------------
An object file.

What do you see instead?
------------------------
Compiler error about redefinition of uint8t.

What version of the product are you using? On what operating system?
--------------------------------------------------------------------
MSVC2005
ffmpeg r 13018
SDL 1.2.13, prebuilt binaries and development files, downloaded from 
http://www.libsdl.org
Windows XP

Please provide any additional information below.
------------------------------------------------
I suggest adding 'signed' to type definitions in stdint.h on lines 59-62

Original issue reported on code.google.com by wl2776@gmail.com on 21 May 2008 at 12:47

GoogleCodeExporter commented 8 years ago
Sorry, not uint8t, but int_8t

Original comment by wl2776@gmail.com on 21 May 2008 at 12:49

GoogleCodeExporter commented 8 years ago
Does adding 'signed' to int*_t typedefs solved your problem? By Standard 
'signed' is 
assumed when missing, so 'singed int' = 'int' and compiler should not 
differentiate 
them.

From what I see I would rather say that we need to surround these typedefs with 
#ifdef guards. And even better, I would recommend to use my version of 
<stdint.h> 
and <inttypes.h> instead of one, embedded in SDL. To do this you just need to 
include it before any SDL includes, define HAVE_STDINT_H and HAVE_INTTYPES_H, 
and 
remove all these declarations from SDL_config_win32.h. It may be also good to 
try to 
push these changes to SDL mainline.

Original comment by alexander.chemeris on 26 May 2008 at 9:31

GoogleCodeExporter commented 8 years ago
Yes, adding 'signed' has solved the problem.
MSVC is known to not to fully support the standard.
I tried including <stdint.h> and <inttypes.h>, this didn't help.
SDL doesn't have these files, it simply defines necessary types in one of its 
headers.

Original comment by wl2776@gmail.com on 26 May 2008 at 8:16

GoogleCodeExporter commented 8 years ago
I was in doubt about this issue for a long time, but finally decided to not 
"fix" 
it. I looked at search results for "typedef __int8 int8_t" and it looks for me 
that 
this "fix" will break the same as fix, because a lot of other projects do not 
add "signed" to these typdefs.
So, again, I propose to fix this in SDL - either using these implementation 
instead 
of their own homebrew one or removing "signed" from them or any other way you 
find 
suitable.

Anyway, thanks for reporting this!

Original comment by ipse....@gmail.com on 17 Jul 2008 at 6:17