Author Topic: Bad stdio.h or something with SDL?  (Read 7417 times)

Offline sasq

  • Multiple posting newcomer
  • *
  • Posts: 13
Bad stdio.h or something with SDL?
« on: November 23, 2005, 10:38:48 pm »
Greetz.
I would to compile SDL template from Code::Blocks 1.0 rc2 with bundled MinGW and I have some strange errors:

Code
mingw32-g++.exe  -pedantic  -ID:\CBlocks\include -c main.cpp -o .objs\main.o
In file included  from D:/CBlocks/include/SDL/SDL_main.h:59,
                  from D:/CBlocks/include/SDL/SDL.h:33,
                  from main.cpp:2
D:/CBlocks/include/SDL/SDL_types.h:64:  error:  ISO C++ does not support `long long'

etc. All according to 'long long' type [is there this type in ANY C/C++ language dialect? :| ]

The errors looks like they comes from stdio.h, so I have done another test: compiled simple console app:

Code
#include <stdio.h>
int main() { }

and i get the same errors. Is that possible that stdio.h bundled with Code::Blocks is scr3w3d? :|
I don't remember that there was the same errors with stdio.h under previous Code::Blocks releases, I'll check this after a while..

BTW I have a proposition to allow copying selected text possibility in build and compiler logs windows [small improvement ;) ]
« Last Edit: November 23, 2005, 10:41:57 pm by sasq »

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Bad stdio.h or something with SDL?
« Reply #1 on: November 23, 2005, 11:46:00 pm »
Greetz.
I would to compile SDL template from Code::Blocks 1.0 rc2 with bundled MinGW and I have some strange errors:

Code
mingw32-g++.exe  -pedantic  -ID:\CBlocks\include -c main.cpp -o .objs\main.o
In file included  from D:/CBlocks/include/SDL/SDL_main.h:59,
                  from D:/CBlocks/include/SDL/SDL.h:33,
                  from main.cpp:2
D:/CBlocks/include/SDL/SDL_types.h:64:  error:  ISO C++ does not support `long long'

etc. All according to 'long long' type [is there this type in ANY C/C++ language dialect? :| ]


Yes, long long s both in C99 and in the GNU C++ dialect. However, you're compiling C++ source files (so no C99) with -pedantic specified (so no GNU extensions). Either rename your source to main.c and continue in C (wouldn't reccomend it ;)) or remove -pedantic from the compiler options. That should fix it.

Quote
BTW I have a proposition to allow copying selected text possibility in build and compiler logs windows [small improvement ;) ]

Known bug: Ctrl+C doesn't work, but right-click -> Copy does.
« Last Edit: November 23, 2005, 11:48:42 pm by Urxae »

Offline sasq

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Bad stdio.h or something with SDL?
« Reply #2 on: November 24, 2005, 01:14:16 am »
This means that I can't compile code using SDL as ISO C++ Standard compliant?
Not good :\
But thanks for answer, it really helped.

BTW Maybe it's a bug also, but under Win2000 Professional I have black rectangular areas in many icons in Code::Blocks. In earlier versions they're isn't there.
And another proposition: it would be nice looking if toolbars were "flat-style" ;) and without additional disturbing frames around. Is it possible to do?
« Last Edit: November 24, 2005, 01:23:54 am by sasq »

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Bad stdio.h or something with SDL?
« Reply #3 on: November 24, 2005, 01:38:27 am »
This means that I can't compile code using SDL as ISO C++ Standard compliant?
Not good :\
But thanks for answer, it really helped.
Pretty much, but only because it uses long long which isn't in the ISO C++ Standard. This basically happened because C++ was standardized in '98, but the latest C standard (which added long long) was published in '99. The C++ standard is therefoer based on an older version of C ('89 I think, not sure).
The next version of C++ will be based on C99 (or later) and will probably include long long. Should be out any decade now ;).

Quote
BTW Maybe it's a bug also, but under Win2000 Professional I have black rectangular areas in many icons in Code::Blocks. In earlier versions they're isn't there.
This indeed happens only on Win2k. It seems it doesn't handle alpha (partial) transparency all that well, and those icons use alpha. The fix is pretty simple though: use non-alpha-using icons ;). Since I'm also using Win2k I even have them right here. Open the attachment to this post and unzip to ${CB_DIR}\share\CodeBlocks\images (overwrite all, of course). Restart Code::Blocks and presto :D.
They're not as pretty as the normal icons on platforms without this problem, so that's why they aren't used by default. Though there was some talk about the installer including both sets and installing this one on Win2k a while back, don't know what became of that.

Quote
And another proposition: it would be nice looking if toolbars were "flat-style" ;) and without additional disturbing frames around. Is it possible to do?
I think someone mentioned this isn't possible with wxDockIt (the library that currently provides the toolbars) last time this was asked.

[attachment deleted by admin]

takeshimiya

  • Guest
Re: Bad stdio.h or something with SDL?
« Reply #4 on: November 24, 2005, 02:34:13 am »
Yeah I remember that talk, it was rick saying "well, anyone wanting to do the icons without alpha send me..."

Note that every icon (in 16x16, 24x24) and even the application icon must don't have alpha.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Bad stdio.h or something with SDL?
« Reply #5 on: November 24, 2005, 03:53:30 am »
I was pretty enthusiastic about it, but then Yiannis said the non-alpha icons looked ugly :-(

And nobody worked on improving them.

Offline sasq

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: Bad stdio.h or something with SDL?
« Reply #6 on: November 24, 2005, 04:36:15 am »
Thanx a lot for the answers and that "patch", Urxae! You are great! :D

A'propos icons: Yes, AFAIK only WinXP supports alpha-blending icons. Maybe the solution is to pack both versions of icons in one ICO file. As I remember, I was doing that in my Win32 API programs - an ICO file can contain several icons, for different color-depths and sizes, in one file. Only I don't know if it's possible to use ICO files in wxWidgets instead of that PNG icons, maybe not ;) [but in the other hand - it is advantage, because one may substitute the icons with his own to get more personal look ;D ]

takeshimiya

  • Guest
Re: Bad stdio.h or something with SDL?
« Reply #7 on: November 24, 2005, 04:57:02 am »
IMHO a good solution to this would be loading the PNGs and replacing the alpha channel with a wxSYS_COLOUR_BTNFACE in real time.

I don't understand why this it's not handled at wxWidgets level yet.
« Last Edit: November 24, 2005, 07:08:46 am by Takeshi Miya »

b_lawson

  • Guest
Re: Bad stdio.h or something with SDL?
« Reply #8 on: February 05, 2006, 04:17:30 am »
Yes, long long s both in C99 and in the GNU C++ dialect. However, you're compiling C++ source files (so no C99) with -pedantic specified (so no GNU extensions). Either rename your source to main.c and continue in C (wouldn't reccomend it ;)) or remove -pedantic from the compiler options. That should fix it.

Unfortunately, I'm now getting these same types of errors as well.  I downloaded and extracted the latest nightly (win32 rev1940) build from last night and all was fine until I started playing around with the compiler flags.  At one point I switched on the -pedantic flag and of course got the errors mentioned above.  However when I switched all flags back to normal (no -pedantic flag and -W for standard errors and -g for debugging info) I still continue to get the errors.  I looked at the .cbp file, which fortunately is XML and discovered that one of my projects still had the -pedantic compiler flag set, so I removed that line manually.  However, I'm still getting the build errors even after reloading the project.

I should note that this is a multi-project workspace.  However, when doing a find in files over all files for the project nothing comes up with a -pedantic in it.  Also, all files are .h/.cpp files.

Any ideas?

b_lawson

  • Guest
Re: Bad stdio.h or something with SDL?
« Reply #9 on: February 05, 2006, 07:20:31 pm »
I just wanted to follow up with this.  The problem was/is apparently there are also unique compiler settings stored somewhere/somehow for the compiler under the menu: Settings->Compiler and Debugger->Global Compiler Settings.  Those flags I guess override any and all "project setting" compiler flags?  So, in there I had accidentally checked the -pedantic flag which was still overrriding my project setting flags.

Anyway, just something to be aware of for noobs like myself.  8)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Bad stdio.h or something with SDL?
« Reply #10 on: February 05, 2006, 07:25:02 pm »
Quote
Those flags I guess override any and all "project setting" compiler flags?
Yes and no. Compiler flags are cumulative in the order Compiler -> Project -> Target.
Currently, there is no option to explicitely turn off an option.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."