-2

I wrote a header file containing function prototypes and imported into the main.c file! all though it compiles and runs i get a warning "implicit declaration of function" for only 1 function! with no other warnings related to the other functions which have prototypes declared in the header file! What is the reason for this?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Suneth Perera
  • 65
  • 2
  • 7
  • 2
    I wish I could see your console which shows the warning containing the line number and read that line in main.c ;) – Arun Nov 25 '16 at 17:42
  • You need to show us the code and the warning. – John Bode Nov 25 '16 at 17:44
  • 1
    You have a typo in line 23. But seriously, how do you expect anyone to tell you what is happening without posting your code and the error message. – Bence Kaulics Nov 25 '16 at 17:45
  • Welcome to Stack Overflow. Please read the [About] and [Ask] pages soon. When you have code that isn't compiling, it is crucial that you show the code, and the exact compiler message for the exact code you show. It is also important that what you show is an MCVE ([MCVE]). With no code shown, there is no way we can answer your question in anything but the most general terms. (I'm curious why you thought the JavaScript Prototype JS tag was appropriate — it is wholly unrelated. Be careful with your tags.) – Jonathan Leffler Nov 25 '16 at 18:28

3 Answers3

0

Probably you are using a function that was not declared. Please refer to link

Community
  • 1
  • 1
0

If you call a function without declaring it, the use of the function becomes it's (implicit) declaration and implicit declarations are actually errors in C. Your program only displays it as a warning because your gcc compiler chooses to.

Since all of your other functions work with the given prototypes, I would suggest to review your function declaration and ensure no typos. If you post your code... I will update my answer with a more appropriate response.

Andrew Nguyen
  • 106
  • 11
  • This is as much a comment as an answer. I know you can't comment yet (but you will be able to do so soon, if you're careful); patience is a virtue. – Jonathan Leffler Nov 25 '16 at 18:31
0

To give a clearer answer I would need to see the code, but for a start, you should never include a .c file. for example, in main.c you should include your header using #include, and then if you have a library you are using, you should include the header file in that as well, but not the main.

It may also be that your function is of the incorrect type, or has a different type than specified in the prototype.

Thefoilist
  • 137
  • 1
  • 11