My problem is simple, but I don't know how to resolve it: I have a Visual Studio 2010 project with idl files for generating COM type library. This project was originally created by VC++ 6.0. The VC 6.0 could compile this project without any error. But I converted it recently and keep trying to compile it in VC 2010. I'm allways getting the following console output message:
1>------ Build started: Project: myProject, Configuration: Debug Win32 ------
1>Build started 08.04.2013 11:23:12.
1>InitializeBuildStatus:
1> Touching ".\Debug\myProject.unsuccessfulbuild".
1>Midl:
1> Processing .\myFile.idl
1> myProject.idl
1>C:\Programme\Microsoft Visual Studio 10.0\VC\include\typeinfo(29): fatal error C1189: #error : This header requires a C++ compiler ...
1>
1>midl : command line error MIDL1003: error returned by the C preprocessor (2)
1>
1>Build FAILED.
I've already figured out that this does only mean, that the MIDL invokes the compiler in "C mode", but not in "C++ mode". The project contains neither .c nor .cpp, has only .h and .idl files: C/C++ section is NOT available at project property pages. I tried to add a dummy.cpp file, to make that missing section available and to be able to default the C++ compiler in it.
The Midl file looks like:
import "unknwn.idl";
//Globale Definitionen
#include "MyProjectGlobaleDefinitionen.h"
//Interfacedeklarationen
interface IMyProjectDcomSchnittstellen;
[
uuid(E6C14CB3-CFFE-11d4-B1A2-00104BC1A971),
helpstring(MyProject_SCHNITTSTELLE_RELEASE_2_HELPSTRING),
version (MyProject_SCHNITTSTELLE_VERSIONSNUMMER)
]
library MyProject_SCHNITTSTELLE_KURZBEZEICHNER
{
importlib("..\\..\\..\\Files\\DLL\\stdole32.tlb");
importlib("..\\..\\..\\Files\\DLL\\MSADO15.dll");
// #include "..\..\common\Hresult_Werte.h"
#include "MyProjectDcomSchnittstellenTypdefinitionen.idl"
#include "IObj1ManagerMyProject.idl"
#include "IObj1ManagerMyProjectEvents.idl"
#include "IObj2Manager.idl"
#include "IObj2NotifySink.idl"
//************ Obj2Manager **************************
[uuid(F0284CF2-8E24-11d4-8941-006097AA387A)]
coclass Obj2Manager
{
[default] interface IObj2Manager;
[default, source] interface IObj2NotifySinkEvents;
}
//************ Obj1ManagerMyProject ************************
[uuid(E6C14CB2-CFFE-11d4-B1A2-00104BC1A971)]
coclass Obj1ManagerMyProject
{
[default] interface IObj1ManagerMyProject;
[default, source] interface IObj1ManagerMyProjectEvents;
}
}; //Ende library Obj1_myProject
How can I force the MIDL to invoke the compiler/preprocessor in "C++ mode"?