Technical information
Operating Precautions for CPDW9X/NT-CDR-V85X, Y-GHS-MULTI-V800
TM
  Customer Notification r20tu0003ed1812  35 
No. a25 
Multiply defined type identifier on virtual functions 
Version Information  
V3.5.1 
Details 
In a C++ project including virtual functions and section renaming the ELXR linker generates the 
following error message: 
[elxr] (error) symbol type identifier for BaseClass multiply defined in  
out\file1.o 
out\file2.o 
[elxr] (error) symbol type identifier for BaseClass multiply defined in  
out\file1.o 
out\file3.o 
(repeated many times for different combinations of files, but the same symbol.) 
The symbol "BaseClass" is a class containing virtual functions only. Several subclasses are 
derived from it. The header file “BaseClass.h” contains this declaration (reduced): 
Class BaseClass { 
 public: 
 virtual int func1(int address); 
 virtual int func2(int pattern); 
 private: 
 }; 
The problem is related to the section renaming during compile time: 
 #pragma ghs section bss=".mybss" 
Virtual functions sometimes require a global variable to be used as a type identifier. These global 
variables only occupy a single byte, but are used to associate virtual functions with the same 
type. Because declarations are often declared entirely in header files, the compiler has no easy 
way to allocate a single global variable. Instead, it tries to declare a “common” global variable in 
every file that needs it. These common variables are all combined at link time. 
But when “#pragma ghs section bss=” is used to rename the “.bss” section, “common” variables 
do not longer exist. Instead, definitions are created in every file, resulting in the multiple 
definitions. 
Workaround 
1) Use section renaming during linking stage. 
2) Enable the option “Force Virtual Tables” on the file “file1.cpp” and enable the option “Suppress 
 Virtual Tables” at the top level of the project. This will cause virtual tables to be created in 
 “file1.o” and not in any other file. With some applications this is difficult because there is no 
 single file or group of files which contain exactly the right set of virtual tables. 










