We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I keep getting a linker error suggesting that a few variables (and some functions) have been declared across multiple files. I've triple checked the files (they're not large) and the erring functions/variables have NOT been declared more than once.
Interestingly, it seems to occur between the file that contains the main function and file A for some, and main and B for some others. Which means that the main file is common. But, the main file does not have these declarations.
Can multiple *definitions* of the same C files, or including the same C files across different #include appearances (in different files) cause the problem?
Any help will be appreciated.
"files A.c and B.c were included in the main file AND added separately as part of the project. I did not know that this was not allowed."
It is allowed; but if you do it, then you have to ensure that it is done right - in particular, that it doesn't cause multiple definitions.
However, just because it can be done doesn't mean that it's a good idea!
In general, you do not #include .c files - you compile them separately, and let the Linker join the pieces together...