MIDL2003 error: override when compiling ATL generated idl with windows. h and sql.h are included

As part of the requirement, I had to include sql.h and windows.h in the generated ATL idl. Unfortunately, he continues to complain when sql.h turned on.

 1>c:\program files (x86)\windows kits\8.0\include\um\sqltypes.h(125): error MIDL2003: redefinition : SQLSCHAR 1>c:\program files (x86)\windows kits\8.0\include\um\sqltypes.h(131): error MIDL2003: redefinition : SQLUINTEGER 

And when windows.h , it complains

 1>C:\Program Files (x86)\Windows Kits\8.0\Include\um\winnt.h(347): error MIDL2003: redefinition : INT 1>C:\Program Files (x86)\Windows Kits\8.0\Include\um\winnt.h(832): error MIDL2003: redefinition : Int64ShllMod32 1>C:\Program Files (x86)\Windows Kits\8.0\Include\um\winnt.h(832): error MIDL2025: syntax error : expecting ; near "{" 

Note I am creating a COM wrapper on top of ODBC, because of which I need to include these files in my generated idl

+4
source share
1 answer

One way around this is to define RC_INVOKED before including the header files. This will skip typedef and #define , which conflict with declarations in MS IDL files.

 import "oaidl.idl"; import "ocidl.idl"; #define RC_INVOKED 1 #include "windows.h" #include "sql.h" 
0
source

Source: https://habr.com/ru/post/1482116/


All Articles