• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 586
  • 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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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