[ale] Error: symbol foo is already defined.

Joe jknapka at earthlink.net
Thu Jan 30 19:11:31 EST 2003


"John Wells" <jb at sourceillustrated.com> writes:

> Trying to remake my kernel modules to add usbdnet, but getting all sorts
> of "Error: symbol X is already defined" messages.
> 
> What's the most common cause of this error?  Is it a problem with
> including two .h files that both declare a variable or constant?  How
> could I debug this?

This error is caused by there being two different, actual compiled
declarations (not extern declarations) of a particular variable or
function. Often, it's caused by the "extern" keyword being left off of
a variable declaration in a .h file.

The linker should tell you the locations (object files or libraries)
of both definitions. Unfortunately, the source file location of the
offending decl is usually lost by link time, so you may have to just
crawl through the list of includes and see where the decl
occurs. Sometimes it's obvious which one is bogus, sometimes not. This
kind of thing is usually trivial to fix if you wrote the code, and a
major PITA otherwise...

-- Joe Knapka

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list