Error 466 - Duplicate name definition

Duplicate name definition - A SUB name, FUNCTION name, label name, or variable name was defined more than once in your code.

Check your program and any Include files for duplicate names and change one or both of them.  A common source of this problem is nested or multiple #INCLUDE files that define the same item.

The compiler always highlights the second incidence of the duplicate name, so a common strategy to quickly locate the first incidence is to move the second incidence as close to the top of the source code as possible.  This effectively reverses the relative positions of first and second incidences, so the next compile-time error will identify what was (originally) the first incidence.

A good technique for dealing with multiple #INCLUDE files is to use conditional compilation blocks to exclude duplicate definitions.  For example:

#IF NOT %DEF(%FILESPEC_INC)

  %FILESPEC_INC = -1

  '...the body of the #INCLUDE file goes here

#ENDIF ' %FILESPEC_INC

...where %FILESPEC_INC is based on the name of the #INCLUDE file or some other distinctive equate.  During compilation, the first incidence will be included in the compiled code (because the equate will not be defined up to that point), but additional incidences will be automatically excluded once the equate is defined.

The WIN32API.INC and related files use this technique extensively.