0

I have a function myfunc defined in a source file myfunc.c and declared in a header file myfunc.h. Both these files are part of a library.

In another project's (projA) source file, I am including the header file as:

#include "myfunc.h"

and using the function correctly (number of parameters, order, etc).

I've edited the Makefile so it has the path to myfunc.h in it's list of includes (-I).

However, I am still getting a warning about implicit declaration. Since projA has warning = error set, it fails on compilation.

Note: this is not an eclipse issue as here, or a missing header as here, or an undeclared function.

Addendum

int myfunc(char * source, size_t source_len, char * dest, size_t dest_len)
{
    // manipulation
    strncpy(dest, source, dest_len);
    // other stuff
}
5
  • 1
    Can you show us your function? Nov 12, 2013 at 19:55
  • Take a look at this gcc.gnu.org/onlinedocs/cpp/Ifdef.html You may need to add this in to your Header files Nov 12, 2013 at 19:55
  • @EyeOfTheHawks thanks! Can you put your answer in the answer sections please? I will accept it. Someone decided to have the same MACRO for two different headers, and the one I wanted was not getting included. Sigh
    – Sagar
    Nov 12, 2013 at 20:04
  • @TonyTheLion adding the function declaration anyway...
    – Sagar
    Nov 12, 2013 at 20:05
  • @Sagar There ya go, added it as an answer Nov 12, 2013 at 20:07

1 Answer 1

1

Take a look at this https://gcc.gnu.org/onlinedocs/cpp/Ifdef.html
You may need to add this in to your Header files to avoid duplicate inclusion

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.