declare nfc variables as global options

81 views Asked by At

am working with the libnfc open source libraries in C, and am trying to declare the variables needed to initialize nfc in global mode i.e.

nfc_device *pnd;
nfc_target nt;
nfc_context *context;
nfc_init(&context);

all outside any function so that they are global, but am getting the following error:

error: expected declaration specifiers or '...' before '&' token
    extern nfc_init(&context);
                    ^

what could be the problem?

EDIT: by the way, they work perfectly when declared within the main method

1

There are 1 answers

0
Peter On

This was solved by putting the 'nfc_init(&context)' call inside the main function, without the EXTERN keyword