Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Compilation problems??

Re: Compilation problems??

From: R124c4u2 <r124c4u2_at_aol.com>
Date: 1997/08/11
Message-ID: <19970811190201.PAA08385@ladder02.news.aol.com>#1/1

 Programming <sysdev_at_mb.sympatico.ca> writes:

The compiler is not prescient. Since you used the implicit prototype, the compiler used the deafult return value, viz, int. If you provide an explicit protype, the error disappears.

> I hope that someone can tell me what
> the compiliation errors are.
> Are they compilation problems??
> Or something else?
>
>
> We are using ORACLE 7.2.3 on AIX.
>
> We write embedded SQL programs (in c) with the suffix.pc.
> We compile with the command:
> make -f makefile char1 (no suffix)
>
> I keep getting very strange error messages, which follow at the bottom.
 

>
>
> It is strange, because I have specifically
> defined the return value of the function as a
> pointer to char. Yet, the error message is
> saying that the return value is an int!
>
> Can anyone tell me if this is a compiler problem,
> or is something wrong with my code? I am
> enclosing the code that I write in c.
>
> #include "stdio.h"
>
> int main()
> {
>
> char *ls_returnvalue;
>
> ls_returnvalue = "";
> ls_returnvalue = checkvalue (); /* line 86 */
> printf("ls_returnvalue is: %s\n", ls_returnvalue);
>
> exit(0);
> } /********** end main ************/
>
> char *checkvalue() /*line 96 */
> {
>
> char *ls_getvalue;
> int li_valid;
>
> ls_getvalue = (char*) malloc(80);
> scanf("%s\n", ls_getvalue);
>
> li_valid = 0;
>
> if (li_valid == 0)
> {
> printf("ls_getvalue is: %s\n", ls_getvalue);
> free (ls_getvalue);
> ls_getvalue = 0;
> } /* end if */
>
>
> } /************ end checkvalue ****************/
>
>
>
> "char1.c", line 86.21: 1506-068 (S) Operation between types "char*" and
 "int" is not
> allowed.
> "char1.c", line 96.7: 1506-343 (S) Redeclaration of checkvalue differs
 from previous
> declaration on line 86 of "char1.c".
> "char1.c", line 96.7: 1506-050 (I) Return type "char*" in redeclaration
 is not
> compatible with the previous return type "int".
> make: 1254-004 The error code from the last command is 1.
>
> Stop.
>
>
> ((
> The same errors also occur if I copy everything to char2.c, and compile
 with:
> cc char2.c
>
> "char2.c", line 9.21: 1506-068 (W) Operation between types "unsigned
 char*" and "int" is
> not allowed.
> "char2.c", line 19.7: 1506-343 (S) Redeclaration of checkvalue differs
 from previous
> declaration on line 9 of "char2.c".
> "char2.c", line 19.7: 1506-050 (I) Return type "unsigned char*" in
 redeclaration is not
> compatible with the previous return type "i.
> ))
>
Received on Mon Aug 11 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US