Mór
78 posts
None |
#13787
Need with a compiler warning on a shared lib 1 year, 2 months ago
I haven't programmed in a long while, and am having trouble with a compiler warning. I'm linking to a shared library using clang and am getting the following warning:
warning: implicit declaration of function 'function_name' is invalid in C99 [-Wimplicit-function-declaration] I have the file included above the function that calls it, so the only thing I can think of that might be causing it, is the function declarations in the shared library's include files, are all declared in the following form: LIBNAME_API void set_window_title(const char *title); I think I had this problem when I used Visual Studio a long time ago. I think I set a compiler setting that gave it the name of of the LIBNAME_API, but I can't remember it. How can I fix this in gcc or clang on Linux/Unix? None |
mmozeiko
Mārtiņš Možeiko
1884 posts
/ 1 project
|
#13788
Need with a compiler warning on a shared lib 1 year, 2 months ago Edited by Mārtiņš Možeiko on Dec. 18, 2017, 6:38 a.m.
You need to show more code. Exactly what you have. Can you reproduce warning on gcc.godbolt.org with small code snippet? For example: https://godbolt.org/g/j4vqoe
|
Mór
78 posts
None |
#13789
Need with a compiler warning on a shared lib 1 year, 2 months ago Edited by Mór on Dec. 18, 2017, 11:21 a.m.
I found out what is causing it, but I don't know how to fix it, other than turn the warning off.
This link describes the problem I am having. https://stackoverflow.com/questio...shared-library-functions-in-linux Replace EXPORT in the code below with the LIBNAME_API I was talking about above and you get the idea.
In the case of the library code, they've used the do nothing option from above, but when I replaced it with the __GNUC__ option the warning remained. Sigh... None |
Mór
78 posts
None |
#13792
Need with a compiler warning on a shared lib 1 year, 2 months ago
Hey not to worry, it has been fixed. It was related to some #ifdefs. I passed it in with a -D<name> option. I think that was what I did with Visual Studio a few years back.
None |