Groups > Borland > Borland C plus plus builder command line tools > Re: Bizarre errors when trying to include SDL




Bizarre errors when trying to include SDL

Bizarre errors when trying to include SDL
27 Jan 2007 08:27:25 -0800
Hi.  I'm trying to use SDL v1.2.11 with one of my projects, but I keep 
getting these weird errors.

This is my program:

----------

#include "SDL.h"

int main(int argv, char* argc[])
{
    return 0;
}

----------

>From that, I get all this:

----------

C:\Borland\BCC55\include\SDL_config_win32.h:55: Error E2176 : Too many 
types in declaration
C:\Borland\BCC55\include\SDL_config_win32.h:56: Error E2176 : Too many 
types in declaration
C:\Borland\BCC55\include\_stddef.h:133: Error E2238 : Multiple 
declaration for 'size_t'
C:\Borland\BCC55\include\SDL_config_win32.h:59: Error E2344 : Earlier 
declaration of 'size_t'
C:\Borland\BCC55\include\SDL_stdinc.h:112: Error E2021 : Array must 
have at least one element
C:\Borland\BCC55\include\SDL_stdinc.h:113: Error E2021 : Array must 
have at least one element
C:\Borland\BCC55\include\SDL_endian.h:84: Warning W8071 : Conversion 
may lose significant digits in function SDL_Swap16(unsigned short)
C:\Borland\BCC55\include\SDL_endian.h:145: Warning W8055 : Possible 
overflow in shift operation in function SDL_Swap64(unsigned long)
C:\Borland\BCC55\include\SDL_endian.h:148: Warning W8055 : Possible 
overflow in shift operation in function SDL_Swap64(unsigned long)
main.cpp:6: Warning W8057 : Parameter 'argv' is never used in function 
SDL_main(int,char * *)
main.cpp:6: Warning W8057 : Parameter 'argc' is never used in function 
SDL_main(int,char * *)
:: === Build finished: 6 errors, 5 warnings ===

----------

For installing SDL, I downloaded the development libraries for Visual C
++ from the SDL web site.  I put SDL.dll in both Borland's Bin 
directory and in my project folder.  I put all of the SDL header files 
into Borland's Include directory.  I called coff2omf on SDL.lib and 
SDLmain.lib and put the new files into Borland's Lib director.

The only flag I set was -w (display all warnings).  I also tried 
replacing "main" with "SDL_main."  Can anyone tell what's
going on?
Post Reply
Re: Bizarre errors when trying to include SDL
Thu, 1 Feb 2007 09:26:26 -0500
The error messages are clear.  There is a problem with the header file. 
When you use a header file that was created for a different compiler it is 
possible that that file is done in a manner which is specific to the 
compiler for which it was intended.  The way one fixes that is to look at 
the header file, determine what items generate the errors and alter them to 
not generate errors.

One thing you could try to see if it reduces the number of errors is to 
include stdio.h and stdlib.h prior to including stl.h

The errors are all from the compiler and not from the linker.  Coff2omf 
creates an import library for the linker to use so it is not an issue here.

.  Ed

> Aaron J. M. wrote in message
> news:1169915245.225962.222650@a34g2000cwb.googlegroups.com...
>
> Hi.  I'm trying to use SDL v1.2.11 with one of my projects, but
> I keep getting these weird errors.
>
> This is my program:
>
> ----------
>
> #include "SDL.h"
>
> int main(int argv, char* argc[])
> {
>    return 0;
> }
>
> ----------
>
>>From that, I get all this:
>
> ----------
>
> C:\Borland\BCC55\include\SDL_config_win32.h:55: Error E2176 : Too many
> types in declaration
> C:\Borland\BCC55\include\SDL_config_win32.h:56: Error E2176 : Too many
> types in declaration
> C:\Borland\BCC55\include\_stddef.h:133: Error E2238 : Multiple
> declaration for 'size_t'
> C:\Borland\BCC55\include\SDL_config_win32.h:59: Error E2344 : Earlier
> declaration of 'size_t'
> C:\Borland\BCC55\include\SDL_stdinc.h:112: Error E2021 : Array must
> have at least one element
> C:\Borland\BCC55\include\SDL_stdinc.h:113: Error E2021 : Array must
> have at least one element
> C:\Borland\BCC55\include\SDL_endian.h:84: Warning W8071 : Conversion
> may lose significant digits in function SDL_Swap16(unsigned short)
> C:\Borland\BCC55\include\SDL_endian.h:145: Warning W8055 : Possible
> overflow in shift operation in function SDL_Swap64(unsigned long)
> C:\Borland\BCC55\include\SDL_endian.h:148: Warning W8055 : Possible
> overflow in shift operation in function SDL_Swap64(unsigned long)
> main.cpp:6: Warning W8057 : Parameter 'argv' is never used in function
> SDL_main(int,char * *)
> main.cpp:6: Warning W8057 : Parameter 'argc' is never used in function
> SDL_main(int,char * *)
> :: === Build finished: 6 errors, 5 warnings ===
>
> ----------
>
> For installing SDL, I downloaded the development libraries for Visual C
> ++ from the SDL web site.  I put SDL.dll in both Borland's Bin
> directory and in my project folder.  I put all of the SDL header files
> into Borland's Include directory.  I called coff2omf on SDL.lib and
> SDLmain.lib and put the new files into Borland's Lib director.
>
> The only flag I set was -w (display all warnings).  I also tried
> replacing "main" with "SDL_main."  Can anyone tell
what's going on?

Post Reply
about | contact