gcc warnings: implicit declaration of function...


 
Thread Tools Search this Thread
Top Forums Programming gcc warnings: implicit declaration of function...
# 1  
Old 08-29-2003
gcc warnings: implicit declaration of function...

I am having strange warnings from gcc compiler, which I don't think should come while cmpiling.
Can anyone help? The warnings are:
- warning: implicit declaration of function 'bzero'
- warning: implicit declaration of function 'inet_addr'

The code is as below:

int main(int argc, char **argv)
{
struct sockaddr_in servaddr;
char buffer[BUFLEN];
int n;

argv0 = argv[0];

if ( (sockfd=Socket(AF_INET,SOCK_STREAM,0)) < 0 )
exit(1);

bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family = AF_INET;

if ( (servaddr.sin_addr.s_addr = inet_addr("131.170.24.42"))
== -1 ) {
fprintf(stderr,"%s : inet_addr failed, errno=%d\n",argv0,errno);
exit(1);
}

.......
.......
}
# 2  
Old 08-29-2003
This I have figured out. I didn't include the header files for bzero(), inet_addr().

Can anyone guide about the other warning?


"void format, different type arg (arg 1)"

The function's on which warning is given, looks like this:
void fprint_stderr_sockarray(int* sockets)
{
..........
..........
}
# 3  
Old 08-29-2003
Sorry All,
The warning comes on the inner line of this function. The line is:

fprintf(stderr,
" } at %p size %d\n",sockets,((MAX_TCPCLIENTS)*(sizeof(int))));

The warning talks about argument 1, so there must be a problem with "sockets parameter", to let you people know sockets is an integer pointer: int* sockets this was sent to function as parameter.

Now whats the problem, can someone tell me? Is this sockets some differetn type from "%p" or what? Btw, what does %p means in fprintf()?


Waiting for response.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Local variable in a C function is not getting created in stack when its compiled with GCC

Hi, I am working in UEFI EDK2 Bios source. We created a platform related new package in the EDK2 source. I find a strange issue with the platform related code we added. When I did source level debugging I noticed the local variable in a C function is not getting created in stack when its... (6 Replies)
Discussion started by: Divya R
6 Replies

2. UNIX for Advanced & Expert Users

FTP over implicit TLS

Here are the essentials: un: myuser pw: mypasswd site: sftp.somesite.com port: 990 type: FTPS enc: FTP over implicit TLS program used: Curl 7.1.x on Hpux 11.31 I would like to "put" 1 file on there server. Here is my syntax, what am I doing wrong? curl -3 -v --cacert... (4 Replies)
Discussion started by: olyanderson
4 Replies

3. Shell Programming and Scripting

Function prototype declaration

Hi All, I have the script as below #!bin/bash let k=9 if then echo "Start" Hello echo "End" else echo "failed" fi function Hello() { echo "hello !!!!" } I got the below error : (4 Replies)
Discussion started by: Balasankar
4 Replies

4. SuSE

RPM implicit dependencies

Hi, I'm having issues with implicit dependencies for my RPM package. This is the error I'm getting: error: Failed dependencies: libclntsh.so.11.1()(64bit) is needed by geomatica-10.4-0.x86_64 Our software has a dynamically loaded library which links to the Oracle's libclntsh.so.11.1... (2 Replies)
Discussion started by: pneveu
2 Replies

5. UNIX for Dummies Questions & Answers

difficult problem with function declaration

Hello, I have a problem with the declaration of a function. This is how I declare the function : c:63: void foo(threadpool *tp,void (*func)(void*), (void*)arg); Inside main, I call it like this: main(){ .......... threadpool y; c:104: ... (4 Replies)
Discussion started by: garag11
4 Replies

6. Programming

implicit declaration of function 'reboot'

Hi, I'm tying to use the following function to reboot the system as part of my code #include <unistd.h> #include <linux/reboot.h> int restart(unsigned int delay) { sleep(delay); return reboot(LINUX_REBOOT_CMD_RESTART); } When I try to compile the code I get the warning in the... (2 Replies)
Discussion started by: galapogos
2 Replies

7. Solaris

Installing gcc - recieve error message gcc : cannot execute

AIM- Install Oracle 11g on Solaris using VMWare Steps 1.Logged on as root 2.Created subfolders à /usr/local/bin & /usr/local/bin/gcc 3.Downloaded gcc & libiconv & unzipped them on my harddrive & burnt them on CD 4.Copied files from CD to /usr/local/bin/gcc 5.Terminal (root) à pkgadd -d... (8 Replies)
Discussion started by: Ackers
8 Replies

8. Shell Programming and Scripting

FTP/implicit SSL

Hi, I want to FTP can some one help me how do I do this manually from unix command line Thanks, (2 Replies)
Discussion started by: sridatos
2 Replies

9. AIX

Implicit login in AIX

only wanted to know .. if I have some tivoli jobs running with different user .. will this mean that everytime the job invokes .. the .profile runs for that user ... or is it that the .profile runs only at explicit LOGINs ... e.g if a cron calls a job under some user, does it run the .profile of... (1 Reply)
Discussion started by: rajesh_149
1 Replies

10. Shell Programming and Scripting

Implicit Ping

Hi All I want some help in writing a script that will: 1. Implicitly ping a server to see if it is up or not. (I have blocked all ICMP traffic on that box) 2. if the server is down send an alert mail to users I have looked and looked but I could not get any way to do this. What I have... (2 Replies)
Discussion started by: skotapal
2 Replies
Login or Register to Ask a Question