Usage issue
aalwatani opened this issue · comments
Hello, his might be a silly problem, but bear with me please. I'm having trouble running the program to get the power readings. I've followed the steps in the readme file, and got to the Usage section.
From what I understand, I need to copy the code in the Usage section to the src folder and run it as a C script. I did so, but it's not compiling.
I'm not sure if what I'm doing is correct or not, or it's the case that I have to modify the code.
Thanks!
I added #include "hosp.c"
in the beginning of the code (is that correct?) because it was giving me the following error
error: unknown type name ‘hosp_device’
hosp_device* hosp = hosp_open();
^
This is the error that I'm getting now, after adding the #include "hosp.c"
error: initializer element is not constant
hosp_device* hosp = hosp_open();
^
If you've installed the library to the system (i.e., you're not editing within the hosp source tree), you typically include files using angle brackets, not quotes -- #include <hosp.h>
. Then add to your -I
compile flags, e.g., -I/usr/local/include/hosp
(or even better, use the output from pkg-config: pkg-config --cflags hosp
).
You will have to initialize from within a function (e.g., main
). You cannot initialize statically.
I'll close this since it appears to be a C programming error, not a bug. LMK if you have additional problems though.