warnings

Posted by Gorock on Fri 28 Oct 2005 10:33 PM — 12 posts, 38,613 views.

#0
how do i make it where warnings are not treated like errors
because i am trying to compile but get this

Compiling o/mccp.o....
cc1: warnings being treated as errors
mccp.c: In function `process_compressed':
mccp.c:65: warning: implicit declaration of function `write'
make[1]: *** [o/mccp.o] Error 1
make: *** [all] Error 2
can i toggle that or anything
Australia Forum Administrator #1
Naturally. Try "man gcc" and search the rather lengthy list of options. In particular:


       -Werror
           Make all warnings into errors.



You need to take that out of your makefile.
#2
ok after that how would i fix this warning?
USA #3
Looks like you forgot an include or something.
USA #4
By consulting "man write" ( you may need to try "man 3 write" ) and seeing which includes it lists as required in the page that discusses the function. This method will work for most glibc library code.
#5
ok i did man 3 write it said No entry for write in section 3 of the manual so then i did man write to read it but it was talking about write is used to send messages to a terminal like echoing messages is this what you were talking about
USA #6
Well ok, so in this case it was "man 2 write" :)
Australia Forum Administrator #7
In case you don't find it, here are the first few lines:


NAME
       write - write to a file descriptor

SYNOPSIS
       #include <unistd.h>

       ssize_t write(int fd, const void *buf, size_t count);


#8
ok i put the include in and it worked just out of curiosity how would i know what include to put in later is there a list of them somewhere or a reference guide or something
USA #9
As Nick showed, the required include files will be noted in the manual of what you're using.
#10
ok but i mean how did he know to type man -2 and all that i didn;t understand
USA #11
It was sort of a lucky guess on my part the first time I tried something like "man 2 write". I had noted that at the bottom of a man page I was looking at that some of the listings had (1) or (3) after them. So I figured I'd find out what using those would do for me and found what I was after :)