Why does the compiler generate duplicate symbol errors when I use automatic instantiation?
This was a limitation in the Version 5.n compilers that has been fixed in the Version 6.n compilers. For more information about Version 5 template limitations, see the discussion of templates in your Version 5.n Using C++ guide. Note also that you cannot do automatic template instantiation if you defined templates and non-templates in the same module. This restriction applies because each time the compiler needs the template implementation, it includes the module that defines it. If that module contains non-template elements, these also are defined, and duplicate symbols can be generated.
Related Questions
- When I generate my business objects, I get a lot of compiler errors about "cannot convert from System.Data.SqlDbType to System.Data.DbType." What is wrong?
- Why must classes reside in headers for automatic template instantiation? Q: Why does the compiler generate undefined template symbols?
- Why does the compiler generate duplicate symbol errors when I use automatic instantiation?