PDA

View Full Version : volatile - extern problem with libusb how do protect external variale?



andreaQt
13th November 2020, 12:05
First at all: on the zip that i have attached is not included the libusb files.

If i decomment inside variabili.h all variable and run in debug mode the program, all gone well (i can read data from my joistick and print it; the main window needed for future implementation).

Inside the comment "TEST 01" i'm trying to protect tha variable, in the original write they are global (i don't want it).

My question is: is it possible to do it or when the program run inside "static void LIBUSB_CALL cb_function(struct libusb_transfer *transfer)" the only way to access to an external variable is to make it global??

I'm not a pure programmer, so if is it possible, please write some how i can do it? Thank you.

andreaQt
14th November 2020, 07:31
I have forgetten to list the errors:
error: undefined reference to `g_exit'
error: undefined reference to `print_only_difference'
error: undefined reference to `answer_old'
error: collect2.exe: error: ld returned 1 exit status