LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   'incompatible implicit declaration' errors when compiling (https://www.linuxquestions.org/questions/linux-software-2/incompatible-implicit-declaration-errors-when-compiling-599499/)

-Pb- 11-14-2007 02:05 AM

'incompatible implicit declaration' errors when compiling
 
I'm trying to install my ISP's billing program in Slackware 12. I've downloaded the tar.gz package, unpacked it, and when I ran _compile.sh as stated in the installation instructions I get the following:

bash-3.1# ./_compile.sh
login.hnt.c: In function 'main':
login.hnt.c:25: warning: incompatible implicit declaration of built-in function 'printf'
login.hnt.c:26: warning: incompatible implicit declaration of built-in function 'exit'
login.hnt.c:38: warning: incompatible implicit declaration of built-in function 'bzero'
login.hnt.c:44: warning: incompatible implicit declaration of built-in function 'printf'
login.hnt.c:69: warning: incompatible implicit declaration of built-in function 'printf'
login.hnt.c: In function 'md5':
login.hnt.c:109: warning: incompatible implicit declaration of built-in function 'strlen'
md5.c: In function 'md5_process':
md5.c:168: warning: incompatible implicit declaration of built-in function 'memcpy'
md5.c: In function 'md5_append':
md5.c:342: warning: incompatible implicit declaration of built-in function 'memcpy'
md5.c:356: warning: incompatible implicit declaration of built-in function 'memcpy'

I did a bit of googling and one of the possible reasons seems to be the lack of ncurses libraries on my system. I installed ncurses-5.6-i486-2. Still no go. What am I missing?

Wim Sturkenboom 11-14-2007 04:20 AM

I doubt very much that this has to do with ncurses.

Start with checking the logo.hnt.c file and see if stdio.h, stdlib.h, strings.h and string.h are included in the beginning of the file (or at least before lines 25, 26, 38 and 109 respectively).

Same for md5.c (only string.h required).

PS Those are only warnings, so you should end up with an executable anyway.

-Pb- 11-14-2007 04:40 AM

Quote:

Originally Posted by Wim Sturkenboom (Post 2958431)
I doubt very much that this has to do with ncurses.

Start with checking the logo.hnt.c file and see if stdio.h, stdlib.h, strings.h and string.h are included in the beginning of the file (or at least before lines 25, 26, 38 and 109 respectively).

Same for md5.c (only string.h required).

PS Those are only warnings, so you should end up with an executable anyway.

Thanks for your reply. You're right, the program is up and runnung. I checked login.hnt.c and there're no mention of stdio.h, stdlib.h, strings.h or string.h.
In fact I managed to install it flawlessly when I did so in a virtual machine. Now, I have Slack on my desktop, I did a custom installation and might have omitted some important packages...

Wim Sturkenboom 11-14-2007 07:14 AM

If you did a full slackware12 install, the compiler stuff should be available.

The include files can be included through another include file. Is there any #include in those files?

-Pb- 11-15-2007 04:59 AM

The problem is I did a custom install. Perhaps, not the best thing for a newbie :)

Yes, there´re strings beginning with #include. Sorry, I'm new to Linux and have no idea of programming, I don't understand what these strings mean and how include files can be included through other include files.

Wim Sturkenboom 11-15-2007 05:50 AM

If an include file contains other includes, those files will be included as well.

So your c file might include mystuff.h and mystuff.h might include stdio.h etc
Code:

/* c-file *
#include "mystuff.h"
...
...

Code:

/* mystuff.h */
#include <stdio.h>
...
...


PAix 11-18-2010 12:39 AM

The exit and bzero warnings are cured by
#include <stdlib.h>
The strlen warnings are cured by
#include <string.h>
I believe that memcpy is also cured by the same header file.

I also believe that printf warnings are cured by:
#include <stdio.h>
The man pages for the functions (strlen, bzero etc.) indicate which header library the functions appear in.

I hope that this has clarified the good advice given previously.


All times are GMT -5. The time now is 05:29 AM.