Yes I have seen that page, and I’ve set up my lib exactly as per the foo example, i.e. just the myFile.c and myFile.h in a folder called myFile in the lib folder. The includes work fine. I think my problem is that I was trying to do something that is just “not” C, if you see what I mean. I wanted do define some global variables in the main.c, and then reference them directly from within a #included file, assuming the #included file would be able to find them as they are global. I thought #include simply copied the text of the target into the place where the #include is define. Then I learned that each included function must be compilable on its own, so I put all the variables into myFile.h, and included that in the myFile.c. I also included it in the main.c, thinking that the main.c program could also reference the same variables, but that gave me the linker errors, probably because I had a guard set up in the .h, so one of my files was not getting the .h file included in it. Without the guard I was getting duplicate definition errors.
I’ve since learned that the correct way is to call the function referencing the variables in the function call parameters (using pass by reference). As I want to pass several arrays and some other variables, I guess it’s going to get a bit messy, and I might be better off just defining the function in the main.c itself as it’s not very big, < 50 lines of code. Or maybe I can put everything in a struct or something. Not sure, I’ve just started playing around with it.
Thanks for having a look at this for me.