I'm not a C++ programmer (but I have used regular C code for implementing low-level machine language equivalent SW for some time), and after trying to modify an existing cC+ program to do what I need (and failing), I've decided to rewrite parts of the code in plain C code.
But to be able to use the data, I need to create some variables that have to be accessible to parts of the existing C++ code.
When I declare a global variable (extern int variable name;
) outside the main program, the compile fails because the references to the global variable aren't within the scope of the cpp parts of the program.
I don't program with multiple files myself, so I was wondering if I need to globally declare the same variables as part of each cpp program that needs to have access to the variables? Is there a another/better way?