Nice People Join This Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

"Simple" compiler error I can't find...

Go down

"Simple" compiler error I can't find... Empty "Simple" compiler error I can't find...

Post  Shahzad Thu Nov 05, 2009 12:10 pm

Double-posted to COMP.LANG.C.MODERATED and COMP.LANG.C++.MODERATED.

I'm trying to compile some source code that came in a shareware package
called SERUS221.ZIP and am receiving one error I just don't understand.
I'm using TURBOC++ Ver. 3.0 running under DOS on a PC.

TCC.EXE, the command-line compiler, can be run in either ANSI C or CPP
mode, and I get slightly different errors depending on which mode I use.

SERFACE.H is the single local "include" file; omitting some leading
comments and trailing #define statements, here are its entire contents:

/*---------------------------------------------------------------------
These are the prototypes for the interface functions in serface.c ---*/

unsigned S_Open ( char * devname , unsigned port , unsigned irq ,
char far * inbptr , unsigned inbord );

unsigned S_SetParms ( unsigned baud , unsigned data , unsigned stop ,
unsigned parity );

unsigned S_Close ( void );

unsigned S_SendChar ( char c );

int S_RecvChar ( void );

unsigned S_SetMode ( char mode );
/*-----------------------------------------------------------------------*/

SERDEMO.C is longer than 200 lines, but the error is related to SERFACE.H,
so I'm not including it here. Here is the output from an ANSI C compile:

C> TCC -A SERDEMO.C
Compilation failed; errors were:
Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
serdemo.c:
Error serface.h 14: ) expected
Warning serdemo.c 96: 'cp' is declared but never used in function comm
Warning serdemo.c 215: Call to function 'S_Open' with no prototype in function main
*** 1 errors in Compile ***

Line 14 in the original file is the second line of the
"unsigned S_Open ( char *... statement shown above.

I see exactly the correct number of right parentheses, and I don't have
a clue as to the real problem. (I tried interchanging the prototype
definition of S_Open with the definition directly below it, and the line
number of the error message moved appropriately, so I don't think the
error is related to some unusual context in SERFACE.H.)

------------ cut here ------------ cut here ------------ cut here ------------

FWIW, when I rename SERDEMO.C to SERDEMO.CPP and try compiling it in CPP
mode; I get different errorS:

C> TCC.EXE SERDEMO.CPP
Linking failed; errors were:
Turbo Link Version 5.0 Copyright (c) 1992 Borland International
Error: Undefined symbol s_close() in module SERDEMO.CPP
Error: Undefined symbol s_open(char near*,unsigned int,unsigned int,char far*,unsigned int) in module SERDEMO.CPP
Error: Undefined symbol s_setparms(unsigned int,unsigned int,unsigned int,unsigned int) in module SERDEMO.CPP
Error: Undefined symbol s_setmode(char) in module SERDEMO.CPP
Error: Undefined symbol s_sendchar(char) in module SERDEMO.CPP
Error: Undefined symbol s_recvchar() in module SERDEMO.CPP
Warning: No stack

but these all appear to be just capitalization problems which I should be
able to solve by eliminating all capital letters in both files, but I
hope I don't have to make that many changes!

I would appreciate suggestions on why the ANSI C mode just doesn't want
to recognize the single "unsigned S_Open" prototype statement.

--Myron.
--
Five boxes preserve our freedoms: soap, ballot, witness, jury, and cartridge
PhD EE (retired). "Barbershop" tenor. CDL(PTX). W0PBV. (785) 539-4448
NRA Life Member and Certified Instructor (Home Firearm Safety, Rifle, Pistol)
--------------------------------------------------------------------------
Answer

In <clcm-20031210-0006@plethora.net> mcalhoun@ksu.edu (mcalhoun) writes:

>SERFACE.H is the single local "include" file; omitting some leading
>comments and trailing #define statements, here are its entire contents:
>
>/*---------------------------------------------------------------------
>These are the prototypes for the interface functions in serface.c ---*/
>
>unsigned S_Open ( char * devname , unsigned port , unsigned irq ,
> char far * inbptr , unsigned inbord );
>
>unsigned S_SetParms ( unsigned baud , unsigned data , unsigned stop ,
> unsigned parity );
>
>unsigned S_Close ( void );
>
>unsigned S_SendChar ( char c );
>
>int S_RecvChar ( void );
>
>unsigned S_SetMode ( char mode );
>/*-----------------------------------------------------------------------*/
>
>SERDEMO.C is longer than 200 lines, but the error is related to SERFACE.H,
>so I'm not including it here. Here is the output from an ANSI C compile:
>
>C> TCC -A SERDEMO.C
>Compilation failed; errors were:
>Turbo C++ Version 3.00 Copyright (c) 1992 Borland International
>serdemo.c:
>Error serface.h 14: ) expected

You have forgotten to tell us the semantics of -A for TCC and most of us
are not familiar with obsolete compilers for obsolete platforms.

If it is supposed to mean ANSI conforming mode, then the compiler is
complaining about the "far" identifier in the declaration of inbptr.
Try to see what happens if you compile without -A.

Compiling C code by pretending that it was C++ code was a silly idea in
the first place.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Shahzad
Shahzad
<<< Admin >>>
>

Posts : 76
Points : 407
Reputation : 0
Join date : 2009-10-28
Location : South Africa, Johannesburg

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum