#include "SDL.h"

This is probably well known question, but after browsing doc and archives I
can’t find clear and offical answer.

  1. I am testing following program:----------------------------------
    #include “SDL.h”

int main()
{
return 0;
}

  1. I have only one SDL.h file, located in:

/usr/local/include/SDL/

  1. “sdl-config --cflags” returns:

-I/usr/local/include/SDL -D_REENTRANT

  1. compiling with gcc 2.95.3 works without warnings:

g++ -pedantic -Wall -o sdl-test.o -c sdl-config --cflags sdl-test.cc

  1. compiling with gcc 3.3 produces “long long” warnings:

/usr/local/gcc3/bin/g++ -pedantic -Wall -o sdl-test.o -c sdl-config --cflags sdl-test.cc

In file included from /usr/local/include/SDL/SDL.h:34,
from sdl-test.cc:1:
/usr/local/include/SDL/SDL_types.h:65: warning: ISO C++ does not support long long' /usr/local/include/SDL/SDL_types.h:67: warning: ISO C++ does not supportlong
long’

  1. When I change “SDL.h” to “SDL/SDL.h” it works without warnings.

  2. Exactly same problem with <SDL.h> and <SDL/SDL.h>. So changing “” into <>
    changes nothing in output, but adding ‘SDL/’ fixes warnings.

Could anyone explain why this happen?


Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

  1. compiling with gcc 3.3 produces “long long” warnings:

/usr/local/gcc3/bin/g++ -pedantic -Wall -o sdl-test.o -c sdl-config --cflags sdl-test.cc

Drop -pedantic. It’s documented as:

“This option is not intended to be useful; it exists only to satisfy
pedants who would otherwise claim that GNU CC fails to support the
ANSI standard.”

You want -Wall -W, not -pedantic. Libraries aren’t expected to compile
with -pedantic without warnings.

  1. Exactly same problem with <SDL.h> and <SDL/SDL.h>. So changing “” into <>
    changes nothing in output, but adding ‘SDL/’ fixes warnings.

Could anyone explain why this happen?

Not sure, but you probably shouldn’t be using -pedantic to begin with.On Wed, Nov 12, 2003 at 08:54:56PM +0100, Jacek Pop?awski wrote:


Glenn Maynard

But why -pedantic produces error with <SDL.h> and does not with <SDL/SDL.h> ?On Wed, Nov 12, 2003 at 04:30:46PM -0500, Glenn Maynard wrote:

  1. Exactly same problem with <SDL.h> and <SDL/SDL.h>. So changing “” into <>
    changes nothing in output, but adding ‘SDL/’ fixes warnings.

Could anyone explain why this happen?

Not sure, but you probably shouldn’t be using -pedantic to begin with.


Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

Jacek Pop?awski wrote:>On Wed, Nov 12, 2003 at 04:30:46PM -0500, Glenn Maynard wrote:

  1. Exactly same problem with <SDL.h> and <SDL/SDL.h>. So changing “” into <>
    changes nothing in output, but adding ‘SDL/’ fixes warnings.

Could anyone explain why this happen?

Not sure, but you probably shouldn’t be using -pedantic to begin with.

But why -pedantic produces error with <SDL.h> and does not with <SDL/SDL.h> ?

Look at the code by yourself in /usr/include/SDL/SDL_types.h :

#if !defined(STRICT_ANSI)
#if defined(GNUC) || defined(MWERKS) || defined(__SUNPRO_C)
#define SDL_HAS_64BIT_TYPE long long
#elif defined(_MSC_VER) /* VC++ /
#define SDL_HAS_64BIT_TYPE __int64
#endif
#endif /
!STRICT_ANSI */

Isn’t pedantic some kind of “STRICT_ANSI” stuff ? :wink:

Stephane

But please re-read my question. I am not asking how to solve warning, I am
asking why <SDL.h> produces warning and <SDL/SDL.h> does not. What is
difference?On Wed, Nov 12, 2003 at 11:59:40PM +0100, Stephane Marchesin wrote:

Look at the code by yourself in /usr/include/SDL/SDL_types.h :


Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

I am willing to bet you that <SDL.h> would not produce the warning, but
“SDL.h” would.

Figuring out why gcc will give different warnings for system headers (I
believe <> is defined as being used for them) then it does for program
headers (“”) is left as an exercise for the reader.On Thu, Nov 13, 2003 at 12:05:37AM +0100, Jacek Pop?awski wrote:

On Wed, Nov 12, 2003 at 11:59:40PM +0100, Stephane Marchesin wrote:

Look at the code by yourself in /usr/include/SDL/SDL_types.h :

But please re-read my question. I am not asking how to solve warning, I am
asking why <SDL.h> produces warning and <SDL/SDL.h> does not. What is
difference?


1024D/E65A7801 Zephaniah E. Hull <@Zephaniah_E_Hull>
92ED 94E4 B1E6 3624 226D 5727 4453 008B E65A 7801
CCs of replies from mailing lists are requested.

I still do not understand why manglement believes that cutting off the
oxygen flow to the brain will INCREASE productivity. The reason they
made that decision is probably because they couldn’t think clearly due
to wearing neckties.
– Paul Tomko on ASR.
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20031114/edfe5f21/attachment.pgp

That’s why I said to re-read discussion. There is no difference in compiler
output between <SDL.h> and “SDL.h”. I better paste it:On Sat, Nov 15, 2003 at 02:52:48AM -0500, Zephaniah E. Hull wrote:

Look at the code by yourself in /usr/include/SDL/SDL_types.h :

But please re-read my question. I am not asking how to solve warning, I am
asking why <SDL.h> produces warning and <SDL/SDL.h> does not. What is
difference?

I am willing to bet you that <SDL.h> would not produce the warning, but
“SDL.h” would.


jp at darkwood:~/test$ cat sdl-test.cc
#include <SDL.h>

int main()
{
return 0;
}

jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc sdl-config --cflags
In file included from /usr/local/include/SDL/SDL.h:34,
from sdl-test.cc:1:
/usr/local/include/SDL/SDL_types.h:65: warning: ISO C++ does not support long long' /usr/local/include/SDL/SDL_types.h:67: warning: ISO C++ does not support long
long’

jp at darkwood:~/test$ cat sdl-test.cc
#include “SDL.h”

int main()
{
return 0;
}
jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc sdl-config --cflags
In file included from /usr/local/include/SDL/SDL.h:34,
from sdl-test.cc:1:
/usr/local/include/SDL/SDL_types.h:65: warning: ISO C++ does not support long long' /usr/local/include/SDL/SDL_types.h:67: warning: ISO C++ does not support long
long’

jp at darkwood:~/test$ cat sdl-test.cc
#include “SDL/SDL.h”

int main()
{
return 0;
}
jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc sdl-config --cflags
jp at darkwood:~/test$

jp at darkwood:~/test$ cat sdl-test.cc
#include <SDL/SDL.h>

int main()
{
return 0;
}
jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc sdl-config --cflags
jp at darkwood:~/test$

jp at darkwood:~/test$ sdl-config --cflags
-I/usr/local/include/SDL -D_REENTRANT

jp at darkwood:~/test$ find /usr/local/include -name SDL.h
/usr/local/include/SDL/SDL.h

jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ --version
g++ (GCC) 3.3

I know this is not serious problem, but I think that it is interesting to find
why it happen. And both on irc and here everyone just repeat obvious things
about -pedantic/ansi and “”/<> which IMHO are not related.


Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

I can’t actually reproduce the problem (as I don’t have a copy of GCC
installed here), but my guess would be that your search-path is setup so
that “SDL.H” resolves to a different file than “SDL/SDL.H”. Now, I’m not
sure, but I believe adding -H to your G++ command line will make it print
out the include files’ full paths.

  • Silicon> ----- Original Message -----

From: jpopl@interia.pl (Jacek Poplawski)
To:
Sent: Saturday, November 15, 2003 2:38 AM
Subject: Re: [SDL] #include “SDL.h”

On Sat, Nov 15, 2003 at 02:52:48AM -0500, Zephaniah E. Hull wrote:

Look at the code by yourself in /usr/include/SDL/SDL_types.h :

But please re-read my question. I am not asking how to solve warning,
I am
asking why <SDL.h> produces warning and <SDL/SDL.h> does not. What is
difference?

I am willing to bet you that <SDL.h> would not produce the warning, but
“SDL.h” would.

That’s why I said to re-read discussion. There is no difference in
compiler
output between <SDL.h> and “SDL.h”. I better paste it:


jp at darkwood:~/test$ cat sdl-test.cc
#include <SDL.h>

int main()
{
return 0;
}

jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc
sdl-config --cflags
In file included from /usr/local/include/SDL/SDL.h:34,
from sdl-test.cc:1:
/usr/local/include/SDL/SDL_types.h:65: warning: ISO C++ does not support
long long' /usr/local/include/SDL/SDL_types.h:67: warning: ISO C++ does not support long
long’

jp at darkwood:~/test$ cat sdl-test.cc
#include “SDL.h”

int main()
{
return 0;
}
jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc
sdl-config --cflags
In file included from /usr/local/include/SDL/SDL.h:34,
from sdl-test.cc:1:
/usr/local/include/SDL/SDL_types.h:65: warning: ISO C++ does not support
long long' /usr/local/include/SDL/SDL_types.h:67: warning: ISO C++ does not support long
long’

jp at darkwood:~/test$ cat sdl-test.cc
#include “SDL/SDL.h”

int main()
{
return 0;
}
jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc
sdl-config --cflags
jp at darkwood:~/test$

jp at darkwood:~/test$ cat sdl-test.cc
#include <SDL/SDL.h>

int main()
{
return 0;
}
jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ -pedantic sdl-test.cc
sdl-config --cflags
jp at darkwood:~/test$

jp at darkwood:~/test$ sdl-config --cflags
-I/usr/local/include/SDL -D_REENTRANT

jp at darkwood:~/test$ find /usr/local/include -name SDL.h
/usr/local/include/SDL/SDL.h

jp at darkwood:~/test$ /usr/local/gcc3/bin/g++ --version
g++ (GCC) 3.3

I know this is not serious problem, but I think that it is interesting to
find
why it happen. And both on irc and here everyone just repeat obvious
things
about -pedantic/ansi and “”/<> which IMHO are not related.


Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from
http://decopter.sf.net


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.536 / Virus Database: 331 - Release Date: 11/3/2003

If you want to know why gcc has unexpected behavior, you should be
asking on a gcc list, not an SDL list.

Note, also, that you didn’t acknowledge in your first post that
-pedantic turns on bogus warnings and shouldn’t actually be used in
practice, so it’s expected that you’d be told “don’t do that”.On Sat, Nov 15, 2003 at 10:38:56AM +0100, Jacek Pop?awski wrote:

I know this is not serious problem, but I think that it is interesting to find
why it happen. And both on irc and here everyone just repeat obvious things
about -pedantic/ansi and “”/<> which IMHO are not related.


Glenn Maynard

I can’t actually reproduce the problem (as I don’t have a copy of GCC
installed here), but my guess would be that your search-path is setup so
that “SDL.H” resolves to a different file than “SDL/SDL.H”.

And this is the reason I wrote that I have only one SDL.h file installed.

Now, I’m not sure, but I believe adding -H to your G++ command line will make
it print out the include files’ full paths.

I tried that, then compared output with diff - no differences (except warning
message).On Sat, Nov 15, 2003 at 06:14:54PM -0700, John Silicon wrote:


Free Software - find interesting programs and change them
NetHack - meet interesting creatures, kill them and eat their bodies
Usenet - meet interesting people from all over the world and flame them
Decopter - unrealistic helicopter simulator, get it from http://decopter.sf.net

Please reply privately to this thread - it’s pretty much off topic. :slight_smile:

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment