Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to #include <whatever.h> installed with apt in Ubuntu

I have just installed hidapi in my Ubuntu 20.04 following the instructions, i.e. by doing

sudo apt install libhidapi-dev

I wrote my program in the file mwe.cpp which contains only this line:

#include <hidapi.h>

and now I want to compile it with

g++ -o mwe.o mwe.cpp

but I get

mwe.cpp:1:10: fatal error: hidapi.h: No such file or directory

How am I supposed to use this module? Sorry for such a basic question but cannot find out.

like image 330
user171780 Avatar asked Dec 09 '25 04:12

user171780


1 Answers

On Ubuntu based systems, the system package libhidapi-dev installs the include files to /usr/include/hidapi, so either include this (-I/usr/include/hidapi) in your command line or #include <hidapi/hidapi.h>

like image 115
Dominic Price Avatar answered Dec 11 '25 18:12

Dominic Price



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!