'Device input event using libevdev in C++
I am trying to get the touch event from Raspberry Pi Touchscreen. I made it work using FT5406 driver in python and evtest in C. However, I want to write code for this in C++. I notice libevdev is very useful in C, but when I call it in C++, like
#include <libevdev/libevdev.h>
it will always give me
Fatal error: libevdev/libevdev.h: No such file or directory
I manually install libevdev and save it under the path of my code and provide complete path of that library, but the same thing happens.
I also try the method according to link, the problem is still here.
I already installed the corresponding package:
sudo apt-get install libevdev-dev
sudo apt-get install libudev-dev
Is anyone can help me out???
Solution 1:[1]
It all depends how you setup your include search paths, as using #include <my_file> won't search the current directory. You'd have to use #include "my_file" for that.
Anyway, don't bother copying to you current directory, simply supply the correct paths.
gcc my_code.c $(pkg-config --cflags --libs libevdev)
Where pkg-config will expand to something like -I/usr/include/libevdev-1.0/ -levdev, where libev-dev-1.0 has a subfolder libevdev.
Solution 2:[2]
Just had this same problem. Just find the proper path to the header file.
sudo find / -name libevdev.h
Then include the path starting from the include directory. Mine was:
/usr/include/libevdev-1.0/libevdev/libevdev.h
So my include line was:
#include <libevdev-1.0/libevdev/libevdev.h>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | fluxrider |
| Solution 2 | Deanie |
