[xsd-users] Build error C2955 from unique_ptr with Visual Studio 2008 SP1

[EXT] Antti Keskinen Antti.Keskinen at basware.com
Fri Apr 15 06:06:50 EDT 2016


Hello!

I am developing an application that uses a third-party module which in turn makes use of XSD-generated classes from XML schema files. The environment specifics are as follows:
- Visual Studio 2008 SP1, building from the VS 2008 Command Prompt using an NMake makefile generated with CMake
- XSD version is 4.0.0, downloaded only few days ago from the CodeSynthesis website
- CMake version 3.5.1

The following command is used to generate the files: 'XSD "schema/conf.xsd" -root-element configuration'. The 'conf.xsd' defines a schema for the application's configuration file, and is rather simple in structure, so I believe there's no error in the validity of the schema itself.

Attempting to compile the generated CXX file results in errors like the following:

...\include\xsd/cxx/xml/dom/auto-ptr.hxx(41) : error C2955: 'xsd::cxx::xml::dom::unique_ptr' : use of class template requires template argument list
        ...\include\xsd/cxx/xml/dom/auto-ptr.hxx(41) : see declaration of 'xsd::cxx::xml::dom::unique_ptr'
        ...\include\xsd/cxx/xml/dom/auto-ptr.hxx(82) : see reference to class template instantiation 'xsd::cxx::xml::dom::unique_ptr<T>' being compiled
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(41) : error C2143: syntax error : missing ',' before '<'
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(44) : error C2059: syntax error : '<'
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(44) : error C2238: unexpected token(s) preceding ';'
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(46) : error C2653: 'base' : is not a class or namespace name
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(46) : error C2146: syntax error : missing ';' before identifier 'pointer'
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(46) : error C2868: 'xsd::cxx::xml::dom::unique_ptr<T>::pointer' : illegal syntax for using-declaration; expected qualified-name
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(53) : error C2143: syntax error : missing ')' before '&&'
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(53) : error C2143: syntax error : missing ';' before '&&'
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(53) : error C2059: syntax error : ')'
...\include\xsd/cxx/xml/dom/auto-ptr.hxx(53) : error C2334: unexpected token(s) preceding ':'; skipping apparent function body

The list of errors goes on and on after these lines, apparently the very first error causes a cascading syntax-error effect where future lines are interpreted incorrectly. Looking at the error, it arises from the headers of the XSD itself, so to me this seems to be a problem with the syntax of the generated code. Perhaps I need to define some specific flag when building with Visual Studio 2008? I tried looking at the CodeSynthesis website, but I could not find any specific compilation flags to consider.

The application I am developing is proprietary in nature, but the third-party module we are using is up for grabs in GitHub. I have managed to extract only the generated files to a stand-alone project, and compiling this file generates the same errors as when compiling as part of the build chain. This leads to the conclusion that the error can be isolated to the schema, the XSD tool and the resulting generated files, and has little or no relation to the third-party module itself.

I could really use some help, or at least pointers on where to look for more information. To me, it seems that this is a compiler problem, but I am unsure on how to verify it.

Regards,
Antti Keskinen




More information about the xsd-users mailing list