Reference: Q0004
Article Last Modified on 28-Nov-2005
After adding a new source file or library to an XLL+ project and saving the project, the following linker error occurs:
In particular, this can occur in a project which previously linked perfectly.LNK2005: symbol multiply defined
The simplest way to fix the problem under Visual Studio.NET and under Visual Studio.NET 2003 is to add the appropriate XLL+ library to the start of the linker's list of Additional Dependencies.
A list of the appropriate libraries is below.
To be sure of curing the problem under Visual Studio 6, instruct the linker to Ignore all default libraries (/NOD) and enter a complete list of libraries required for the build.
A full list of the libraries required for the various builds is below.
In the Additional Dependencies field, add the XLL+ library name at the start of the list.
The library names for the various builds are listed below. Please note the spelling carefully.
| Build | Library |
|---|---|
| STL Release | xlllibsr.lib |
| STL Debug | xlllibsd.lib |
| MFC Release | xlllibr.lib |
| MFC Debug | xlllibd.lib |
In the Link tab of the Project Settings dialog, select the Input category, and check the field Ignore all default libraries, as shown below. Note that you will need to do this for both builds, Debug and Release.
In the Object/library modules field add the required libraries at the beginning (i.e. left-hand side) of the list. The required libraries are as follows. Ensure that you select the correct libraries for the builds you are using.
| Build | Libraries |
| MFC Debug | xlllibd.lib mfc42d.lib mfcs42d.lib msvcrtd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib advapi32.lib shell32.lib comctl32.lib uuid.lib mfco42d.lib oledlg.lib ole32.lib olepro32.lib oleaut32.lib urlmon.lib mfcd42d.lib msvcprtd.lib oldnames.lib version.lib |
| MFC Release | xlllibr.lib mfc42.lib mfcs42.lib msvcrt.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib advapi32.lib shell32.lib comctl32.lib uuid.lib oledlg.lib ole32.lib olepro32.lib oleaut32.lib urlmon.lib msvcprt.lib oldnames.lib version.lib |
| STL Debug | xlllibsd.lib uuid.lib libcpmtd.lib libcmtd.lib oldnames.lib kernel32.lib version.lib |
| STL Release | xlllibsr.lib uuid.lib libcpmt.lib libcmt.lib oldnames.lib kernel32.lib version.lib |