[xsd-users] Cannot link against polymorphic type
Babinskas, Albert
albert.babinskas at imagingsciences.com
Thu Apr 14 14:04:49 EDT 2016
Hello,
I have a problem where I receive a linker error against polymorphic type object. My schema compiles and I have output files, but once I try to link against them I receive linker error for polymorphic type object. My setup is this, I have a master schema.xsd which has most of my elements. Then I also import additional examoption-v1.xsd schema. Examoption-v1.xsd schema has the polymorphic elements that I cannot link against in my application.
I compile examoption-v1.xsd with this command:
xsd.exe cxx-tree --char-type char --char-encoding utf8 --generate-default-ctor --generate-wildcard --generate-polymorphic --polymorphic-type=examOption_t --polymorphic-type examOption --polymorphic-type-all examoption-v1.xsd
I tried various combinations of -polymorphic-type, which didn't work.
I compile schema.xsd with this command:
xsd.exe cxx-tree --char-type char --char-encoding utf8 --generate-serialization --generate-ostream --generate-default-ctor --generate-wildcard --generate-polymorphic --polymorphic-type examOption_t --polymorphic-type-all --namespace-map http://api.ditcdev.com/schema/datawarehouse/v1.3.0-130=schema::datawarehouse schema1.xsd
My exampoption-v1.xsd looks like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://api.ditcdev.com/schema/examoption/v1"attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://api.ditcdev.com/schema/examoption/v1"version="1.0">
<xs:element name="examOption" type="tns:examOption_t"/>
<xs:element name="panoramic" type="tns:panoramic_t"/>
<xs:complexType abstract="true" name="examOption_t"><xs:sequence><xs:element minOccurs="0" name="notes" type="xs:string"/></xs:sequence></xs:complexType>
<xs:complexType name="panoramic_t">
<xs:complexContent>
<xs:extension base="tns:examOption_t">
<xs:sequence>
<xs:element minOccurs="0" name="program" type="tns:panoramicProgram_t"/>
<xs:element minOccurs="0" name="regions">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="region" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
My schema.xsd beginning looks like this:
xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://api.ditcdev.com/schema/examoption/v1"xmlns:tns="http://api.ditcdev.com/schema/datawarehouse/v1.3.0-130" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://api.ditcdev.com/schema/datawarehouse/v1.3.0-130" version="1.0">
<xs:import namespace="http://api.ditcdev.com/schema/examoption/v1" schemaLocation="examoption-v1.xsd"/>
Now when I compile my schema.hxx does get #include "examoption-v1.hxx".
When I add #include "schema.hxx" into my project I get a link error:
Severity
Code
Description
Project
File
Line
Suppression State
Error
LNK2019
unresolved external symbol "public: __thiscall schema::examoption::v1::panoramic_t::panoramic_t(class xercesc_3_1::DOMElement const &,class xsd::cxx::tree::flags,class xsd::cxx::tree::_type *)" (??0panoramic_t at v1@examoption at schema@@QAE at ABVDOMElement@xercesc_3_1@@Vflags at tree@cxx at xsd@@PAV_type at 789@@Z) referenced in function "class std::auto_ptr<class xsd::cxx::tree::_type> __cdecl xsd::cxx::tree::factory_impl<class schema::examoption::v1::panoramic_t>(class xercesc_3_1::DOMElement const &,class xsd::cxx::tree::flags,class xsd::cxx::tree::_type *)" (??$factory_impl at Vpanoramic_t@v1 at examoption@schema@@@tree at cxx@xsd@@YA?AV?$auto_ptr at V_type@tree at cxx@xsd@@@std@@ABVDOMElement at xercesc_3_1@@Vflags at 012@PAV_type at 012@@Z)
What am I doing wrong?
I read polymorphic section in manual. I am not sure where the problem is.
-Albert
More information about the xsd-users
mailing list