Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 533
  • Last Modified:

incompatible implicit declaration of built-in function âexitâ

Hi,

I downloaded a software at here and followed the instructions in readme file.
I made a compile version of msa but it seemed failure in Linux Fedora 14.
make msa

Open in new window

Got a warning
incompatible implicit declaration of built-in function âexitâ

Open in new window


Could you please take a look?
Thanks.
0
zhshqzyc
Asked:
zhshqzyc
  • 8
  • 5
1 Solution
 
Bryan ButlerCommented:
#include <stdlib.h>

This is missing or something else is wrong.  Edit the file giving problems and add it at the top if it's not there already.  Or disable the warning with "-fno-builtin-exit" compiler option.  Fixing it would be the thing to do though.
0
 
evilrixSenior Software Engineer (Avast)Commented:
At a guess I would say the source code that is calling the standard exit function is missing the include stdlib.h
http://www.cplusplus.com/reference/clibrary/cstdlib/exit/

It is called in both main.c and ecalc.c and I see no way stdlib.h is included in either. Note, I have not tried to build this but this would be the first thing I would check. Try adding #include <stdlib.h> at the top of these files just under the inclusion of stdio.h and see if that helps.
0
 
evilrixSenior Software Engineer (Avast)Commented:
Oooh, sorry developedtester -- seems you are typing a little faster than me today :)
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 
zhshqzycAuthor Commented:
I added it. However
-bash-4.1$ make msa
cc -O -c main.c 
main.c: In function âdataâ:
main.c:331:3: warning: incompatible implicit declaration of built-in function âstrcpyâ
main.c: In function âgetseqâ:
main.c:620:5: warning: incompatible implicit declaration of built-in function âstrlenâ
main.c:630:21: warning: incompatible implicit declaration of built-in function âstrlenâ
main.c: In function âallocâ:
main.c:1395:8: error: conflicting types for âmallocâ
make: *** [main.o] Error 1

Open in new window

main.c is attached.
main.c
0
 
evilrixSenior Software Engineer (Avast)Commented:
Add string.h
0
 
zhshqzycAuthor Commented:
Now
-bash-4.1$ make msa
cc -O -c main.c 
main.c: In function âallocâ:
main.c:1395:8: error: conflicting types for âmallocâ
make: *** [main.o] Error 1

Open in new window

line 1395 is
 char	*malloc();

Open in new window

0
 
evilrixSenior Software Engineer (Avast)Commented:
Ok, you may also need malloc.h :)
0
 
zhshqzycAuthor Commented:
Still wrong even added it.
0
 
evilrixSenior Software Engineer (Avast)Commented:
Hmmm. There isn't a great deal about that specific error but one thing to try adding the compile time flag --without-gnu-malloc
0
 
evilrixSenior Software Engineer (Avast)Commented:
>> try adding the compile time flag --without-gnu-malloc
http://www.gnu.org/s/hello/manual/gnulib/malloc.html
0
 
zhshqzycAuthor Commented:
-bash-4.1$ make msa  --without-gnu-malloc 
make: unrecognized option '--without-gnu-malloc'

Open in new window

Is it?
0
 
evilrixSenior Software Engineer (Avast)Commented:
Hmmm. Ok, I need to try building this myself but I'm not in a position to do that right this minute. I'll take a look in a bit and get back to you.
0
 
evilrixSenior Software Engineer (Avast)Commented:
Ok, at about line 1397 (with your two new headers added) comment out the line that reads "char  *malloc();".
Once done it should build.
char *alloc (bytes)
register int   bytes;
{
   register char  *memory;
/* auto     char  *malloc();*/
/* char  *malloc(); */ //<----------------------------------------comment out this line!

   if ((memory=malloc((unsigned)bytes))== NULL)
      fatal("Cannot allocate memory.");
   return memory;
}

Open in new window

0
 
zhshqzycAuthor Commented:
Thanks.
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now