Operating System - Linux
1828342 Members
3282 Online
109976 Solutions
New Discussion

Re: Syntax checking using gcc

 
Patrick Chim
Trusted Contributor

Syntax checking using gcc

Hi,

I am using Itanium 11.23 ia64 which install gcc 4.0.2 and ANSI C.

In our makefile, we use the gcc to check our program syntax and then using ansi c to compile our programs.

But the following messages prompted when we build our programs. Does anyone know the meaning of it ?

/usr/local/lib/gcc/ia64-hp-hpux11.23/4.0.2/include/stdio.h:699: error: conflicting types for 'snprintf'

Regards,
Patrick
8 REPLIES 8
Stephen Keane
Honored Contributor

Re: Syntax checking using gcc

Do you have __STDC__ defined in your make file?
Muthukumar_5
Honored Contributor

Re: Syntax checking using gcc

Can you post your makefile? What is execution result for makefile.

http://lists.gnu.org/archive/html/help-cfengine/2004-06/msg00121.html

Are you giving reference to library as -l then give direct link to that. May be work.

hth.
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: Syntax checking using gcc

Where do you get this error ? Can you post exact details ?

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Patrick Chim
Trusted Contributor

Re: Syntax checking using gcc

Hi,

Below are all the error messages,

mkmf: creating ./Makefile from /opt/cis/scripts/makefile.main
mkmf: "/usr/include/arpa/inet.h", line 71: can't find "../h/stdsyms.h"
mkmf: recursive include nesting of "/usr/include/sys/types.h" in "/usr/include/machine/sys/_types.h"
mkmf: recursive include nesting of "/usr/include/machine/sys/_types.h" in "/usr/include/.unsupp/sys/_types.h"
mkmf: recursive include nesting of "/usr/include/sys/uio.h" in "/usr/include/sys/file.h"
mkmf: recursive include nesting of "/usr/include/netinet/in.h" in "/usr/include/netinet/in6.h"
/usr/local/bin/gcc -DDOTC_SRC -I/informix/incl -I/informix/incl/esql -I/opt/cis/prod/src -I. -I. -S -O2 -Wall -Wno-unknown-pragmas -
Werror batchEnquiry.c -o /dev/null
In file included from batchEnquiry.c:199:
/usr/local/lib/gcc/ia64-hp-hpux11.23/4.0.2/include/stdio.h:699: error: conflicting types for 'snprintf'
*** Error code 1

Stop.
make: stopped in /home/cisprod/tt/cis/main/batchEnquiry
ERROR - could not compile ./batchEnquiry

Regards,
Patrick
Arunvijai_4
Honored Contributor

Re: Syntax checking using gcc

1) Are you using "make" ?If yes, try to compile with gmake.

2) http://lists.gnu.org/archive/html/bug-cfengine/2003-04/msg00033.html

May be little tweak in the code could help

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Muthukumar_5
Honored Contributor

Re: Syntax checking using gcc

Check this:

http://lists.samba.org/archive/samba-technical/2002-September/024194.html

May be a problem with make.

Another way is,

Remote -Werror from,

/usr/local/bin/gcc -DDOTC_SRC -I/informix/incl -I/informix/incl/esql -I/opt/cis/prod/src -I. -I. -S -O2 -Wall -Wno-unknown-pragmas -
Werror batchEnquiry.c -o /dev/null

May be it will work.

hth.
Easy to suggest when don't know about the problem!
Steve Ellcey
Valued Contributor

Re: Syntax checking using gcc

Well, I believe that GCC is trying to tell you that snprintf does not have the return type that GCC thinks it should have. I tried to reproduce this locally but could not. If GCC were seeing two conflicting declarations for snprintf, it should give the location of each. Since it doesn't I think that GCC is saying that the definition it does see is not what it expects based on an internal table of known functions that it has. Can you look at /usr/local/lib/gcc/ia64-hp-hpux11.23/4.0.2/include/stdio.h and find the declaration of snprintf and tell us what it is? It should be declared an int function. It might also be useful to look at /usr/include/stdio.h and find the declaration of snprintf there and see if it is different.

The reason this is an error, of course, is your use of -Werror which turns warnings into errors. But I assume you want this flag because you are specifically using GCC for error checking your code.

Also, was this version of GCC downloaded from somewhere or did you build it yourself? Knowning where it came from might help figure out what is going on.
Patrick Chim
Trusted Contributor

Re: Syntax checking using gcc

Hi,

After changing our coding, we have solved the problem.

In some of our .h file, we add the following lines,

#ifndef __ia64
:
:
#endif

Thanks a lot !

Regards,
Patrick