I am constantly having errors that something has been duplicated in another file. I have global data (structure) that is declared in a file called main.h. Any other file that needs this data cannot see it, so I add #include "main.h" which causes errors.
It is like you have to write all you code in one huge file to use global values. Split the code into separate files and you cannot use them. Why is the language so restrictive. If not then how do you do it.
Attached is a simple test problem that shows the problem.
Ray.
Original Attachment has been moved to: Include_Test.zip
Solved! Go to Solution.
in your code, you define variable "map" in the main.h file. thus each time you include the main.h in one c file, the "map" is defined. that's equals to you define "map" multi times in your project.
to correct it, you need define map in c file and declare it as external in .h file.
i modified your code. see attached.
in your code, you define variable "map" in the main.h file. thus each time you include the main.h in one c file, the "map" is defined. that's equals to you define "map" multi times in your project.
to correct it, you need define map in c file and declare it as external in .h file.
i modified your code. see attached.
Thank you.
I had tried that before and got errors. The other change you made was the to put typedef before the struct. With this it works.
Ray.
you are welcome!