Hi, Sending to list...
> I live a problem with avr gcc: When i use a global variable in the header > file and simultaneously initialize it to nonzero value in the declaration, > then the use of this header file in multiple project source files as an > include causes "multiple definition error" on this specific lines in the > header file. Not initialized globals (by myself) and defines do not cause > any error. the whole header file content is in a conditional define, in a > regular manner, so i dont understand what is going on. what is wrong? In the header file, you need to use the word extern. Putting: int x; says to allocate storage for an int sized variable named x. Since this is in a header file, every C file that includes the header file will try to create a variable named x, which is where the multiple declarations are coming from. Using: extern int x; says that somebody else has allocated storage for an int sized variable named x. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list