0

I'm creating simple web service client in CPP. I have generated source files from WSDL with help of svcutil ans wsutil utilites. At the end I got web service interface header and C file.

When I include C file into my console application that uses precompiled header I have message:

Error   3   error C1853: 'Debug\TestLib3.pch' precompiled header file is from a previous version of the compiler, or the precompiled header is C++ and you are using it from C (or vice versa)  

How to solve this problem?

vico
  • 17,051
  • 45
  • 159
  • 315

1 Answers1

0

The C compiler cannot use a .pch file that was generated by the C++ compiler. Two basic options:

  • Rename the .c file to .cpp, likely to work fine on an auto-generated source file.

  • Right-click the .c file in the Solution Explorer window, Properties, C/C++, Precompiled headers, "Precompiled Header" option. Change it to "Not using". You may also need to modify C++ source files that #includes the .h file, it is liable to require extern "C" {} around the #include directive so the C++ compiler knows that the .h file contains C declarations. You'll know this is needed when you get linker errors that show the mangled name of the function.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536