Search code examples
c++wcfwwsapi

WS_CPLUSPLUS with WWSAPI


I am implementing a relatively complex object model service using WWSAPI (WCF hosted) and have successfully downloaded the wsdl and code gen'd the service implementation. My question is, has anyone else noticed all of the

#if defined(WS_CPLUSPLUS)

defines littered throughout the generated code? Inside them is a C++ object representation of my service payload that would be 100x easier to use, however when I define WS_CPLUSPLUS all sorts of bad breaks loose on the compiler.

My question is this: Has anyone successfully gotten that define to work, and if so, what resource or example did you use to get it to work?


Solution

  • Ok, answered my own question after digging through the sdk samples.

    Once you generate the schema and wsdl files and import them into your project do the following:

    • Select all of the generated .c files, and right click -> properties
    • In the [Precompiled Headers] section: Change [Precompiled Header] to "Not Using Precompiled Headers"
    • In the [Advanced] section: Change [Compile As] to "Compile as C++ Code (/TP)"

    Once you do this, you should successfully be able to add the "WS_CPLUSPLUS" preprocessor definition. I hope this can help brighten someones day