I am trying to compile a small prog with inotify but compilation fail:
Inotify.c:19:8: warning: implicit declaration of function ‘inotify_init’ [-Wimplicit-function-declaration]
fd = inotify_init();
^~~~~~~~~~~~
Inotify.c:27:8: warning: implicit declaration of function ‘inotify_add_watch’ [-Wimplicit-function-declaration]
wd = inotify_add_watch( fd, "/sys/bus/w1/devices/28-000003f1a254/temperature", IN_MODIFY | IN_DELETE
); ..
..
Any idea??
Many thanks
zeneca wrote:
I am trying to compile a small prog with inotify but compilation fail:
Inotify.c:19:8: warning: implicit declaration of function
‘q’
[-Wimplicit-function-declaration]
fd = inotify_init();
^~~~~~~~~~~~
Inotify.c:27:8: warning: implicit declaration of function
‘inotify_add_watch’ [-Wimplicit-function-declaration]
wd = inotify_add_watch( fd,
"/sys/bus/w1/devices/28-000003f1a254/temperature", IN_MODIFY |
IN_DELETE ); ..
..
Any idea??
Many thanks
how are you calling the compiler. You should be using -I (for the
includes)
and -L (for the library path)
something like
gcc -I/usr/include -L/usr/lib -l somelib source.c -o output.bin
On Fri, 08 Jul 2022 18:05:40 +0200, Deloptes wrote:
zeneca wrote:
I am trying to compile a small prog with inotify but compilation fail:
Inotify.c:19:8: warning: implicit declaration of function
‘q’
[-Wimplicit-function-declaration]
fd = inotify_init();
^~~~~~~~~~~~
Inotify.c:27:8: warning: implicit declaration of function
‘inotify_add_watch’ [-Wimplicit-function-declaration]
wd = inotify_add_watch( fd,
"/sys/bus/w1/devices/28-000003f1a254/temperature", IN_MODIFY |
IN_DELETE ); ..
..
Any idea??
Many thanks
how are you calling the compiler. You should be using -I (for the
includes)
and -L (for the library path)
something like
gcc -I/usr/include -L/usr/lib -l somelib source.c -o output.bin
Looks like your source should have the following among the other includes:
#include <sys/inotify.h>
Have you run "man inotify" and read its descriptionof the inotify APIs?
Le 8/07/22 à 18:37, Martin Gregorie a écrit :
On Fri, 08 Jul 2022 18:05:40 +0200, Deloptes wrote:
zeneca wrote:
I am trying to compile a small prog with inotify but compilation fail: >>>>
Inotify.c:19:8: warning: implicit declaration of function
‘q’
[-Wimplicit-function-declaration]
fd = inotify_init();
^~~~~~~~~~~~
Inotify.c:27:8: warning: implicit declaration of function
‘inotify_add_watch’ [-Wimplicit-function-declaration]
wd = inotify_add_watch( fd,
"/sys/bus/w1/devices/28-000003f1a254/temperature", IN_MODIFY |
IN_DELETE ); ..
..
Any idea??
Many thanks
how are you calling the compiler. You should be using -I (for the
includes)
and -L (for the library path)
something like
gcc -I/usr/include -L/usr/lib -l somelib source.c -o output.bin
Looks like your source should have the following among the other
includes:
#include <sys/inotify.h>
Have you run "man inotify" and read its descriptionof the inotify
APIs?
#include <linux/inotify.h>
* The error isn’t about a #include file or library not being found.
Adding -I or -L options will not make any difference.
zeneca <pasIci@ailleur.fr> writes:
Le 8/07/22 à 18:37, Martin Gregorie a écrit :
On Fri, 08 Jul 2022 18:05:40 +0200, Deloptes wrote:
zeneca wrote:
I am trying to compile a small prog with inotify but compilation fail: >>>>>
Inotify.c:19:8: warning: implicit declaration of function
‘q’
[-Wimplicit-function-declaration]
fd = inotify_init();
^~~~~~~~~~~~
Inotify.c:27:8: warning: implicit declaration of function
‘inotify_add_watch’ [-Wimplicit-function-declaration]
wd = inotify_add_watch( fd,
"/sys/bus/w1/devices/28-000003f1a254/temperature", IN_MODIFY |
IN_DELETE ); ..
..
Any idea??
Many thanks
how are you calling the compiler. You should be using -I (for the
includes)
and -L (for the library path)
something like
gcc -I/usr/include -L/usr/lib -l somelib source.c -o output.bin
This is a bad guess for two reasons:
* GCC already searches in the right places, there is no need to specify
extra -I or -L options for system headers and libraries.
* The error isn’t about a #include file or library not being found.
Adding -I or -L options will not make any difference.
Looks like your source should have the following among the other
includes:
#include <sys/inotify.h>
Have you run "man inotify" and read its descriptionof the inotify
APIs?
#include <linux/inotify.h>
That will not work. As the man page says, it should be <sys/inotify.h>.
Le 9/07/22 à 10:18, Richard Kettlewell a écrit :
That will not work. As the man page says, it should be <sys/inotify.h>.
As I said, there is no /usr/include/sys/ directory on Raspberry
On Centos7.9 there are
/usr/include/sys/inotify.h AND
/usr/include/linux/inotify.h
on Centos7.9 the very same program run with #include <linux/inotify.h>
but compile fail on raspberry.
Le 9/07/22 à 10:18, Richard Kettlewell a écrit :
zeneca <pasIci@ailleur.fr> writes:
Le 8/07/22 à 18:37, Martin Gregorie a écrit :
On Fri, 08 Jul 2022 18:05:40 +0200, Deloptes wrote:
zeneca wrote:
I am trying to compile a small prog with inotify but compilation
fail:
Inotify.c:19:8: warning: implicit declaration of function
‘q’
[-Wimplicit-function-declaration]
fd = inotify_init();
^~~~~~~~~~~~
Inotify.c:27:8: warning: implicit declaration of function
‘inotify_add_watch’ [-Wimplicit-function-declaration]
wd = inotify_add_watch( fd,
"/sys/bus/w1/devices/28-000003f1a254/temperature", IN_MODIFY |
IN_DELETE ); ..
..
Any idea??
Many thanks
how are you calling the compiler. You should be using -I (for the
includes)
and -L (for the library path)
something like
gcc -I/usr/include -L/usr/lib -l somelib source.c -o output.bin
This is a bad guess for two reasons:
* GCC already searches in the right places, there is no need to specify
extra -I or -L options for system headers and libraries.
* The error isn’t about a #include file or library not being found.
Adding -I or -L options will not make any difference.
Looks like your source should have the following among the other
includes:
#include <sys/inotify.h>
Have you run "man inotify" and read its descriptionof the inotify
APIs?
#include <linux/inotify.h>
That will not work. As the man page says, it should be <sys/inotify.h>.
As I said, there is no /usr/include/sys/ directory on Raspberry
On Centos7.9 there are
/usr/include/sys/inotify.h AND
/usr/include/linux/inotify.h
on Centos7.9 the very same program run with #include <linux/inotify.h>
but compile fail on raspberry.
zeneca <pasIci@ailleur.fr> writes:
Le 9/07/22 ?? 10:18, Richard Kettlewell a ??crit??:
That will not work. As the man page says, it should be <sys/inotify.h>.
As I said, there is no /usr/include/sys/ directory on Raspberry
On Centos7.9 there are
/usr/include/sys/inotify.h AND
/usr/include/linux/inotify.h
on Centos7.9 the very same program run with #include <linux/inotify.h>
but compile fail on raspberry.
You???ve been given the answer. If you don???t like it, that???s your problem.
On 2022-07-09, Richard Kettlewell <invalid@invalid.invalid> wrote:
zeneca <pasIci@ailleur.fr> writes:
Le 9/07/22 ?? 10:18, Richard Kettlewell a ??crit??:
That will not work. As the man page says, it should be <sys/inotify.h>. >>>As I said, there is no /usr/include/sys/ directory on Raspberry
On Centos7.9 there are
/usr/include/sys/inotify.h AND
/usr/include/linux/inotify.h
on Centos7.9 the very same program run with #include <linux/inotify.h>
but compile fail on raspberry.
You’ve been given the answer. If you don’t like it, that’s your problem.
Not very helpfull.
I think maybe the inotify webpage is wrong on debian based systems.
On an Intel Debian abased system I have ...
# cd /usr/include/
# find . -name inotify.h
./linux/inotify.h
./x86_64-linux-gnu/sys/inotify.h
./x86_64-linux-gnu/bits/inotify.h
and on a raspberry pi ...
# cd /usr/include/
# find . -name inotify.h
./arm-linux-gnueabihf/sys/inotify.h
./linux/inotify.h
# find . -name inotify.h -exec grep inotify_init {} /dev/null \; ./arm-linux-gnueabihf/sys/inotify.h:/* Flags for the parameter of inotify_init1. */
./arm-linux-gnueabihf/sys/inotify.h:extern int inotify_init (void) __THROW; ./arm-linux-gnueabihf/sys/inotify.h:extern int inotify_init1 (int __flags) __THROW;
I believe that the arch. specific sys includes are default. So you
should only need ...
#include <inotify.h>
I am trying to compile a small prog with inotify but compilation fail:
Inotify.c:19:8: warning: implicit declaration of function ‘inotify_init’ [-Wimplicit-function-declaration]
fd = inotify_init();
^~~~~~~~~~~~
Inotify.c:27:8: warning: implicit declaration of function ‘inotify_add_watch’ [-Wimplicit-function-declaration]
wd = inotify_add_watch( fd, "/sys/bus/w1/devices/28-000003f1a254/temperature", IN_MODIFY | IN_DELETE ); ..
..
Any idea??
Many thanks
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 371 |
Nodes: | 16 (2 / 14) |
Uptime: | 36:50:09 |
Calls: | 7,932 |
Calls today: | 2 |
Files: | 12,998 |
Messages: | 5,805,537 |