transact.h(226) : error C2059: syntax error : 'constant'

f:\program files\microsoft visual studio\vc98\include\transact.h(226) : error C2059: syntax error : 'constant'
f:\program files\microsoft visual studio\vc98\include\transact.h(271) : error C2143: syntax error : missing ';' before '}'
f:\program files\microsoft visual studio\vc98\include\oledb.h(17149) : error C2143: syntax error : missing ';' before '}'
f:\program files\microsoft visual studio\vc98\include\oledb.h(17149) : error C2143: syntax error : missing ';' before '}'
f:\program files\microsoft visual studio\vc98\include\oledb.h(17149) : error C2143: syntax error : missing ';' before '}'

vc6 + sdk03
头文件搜索的顺序,sdk03的include路径比较vc6的靠前


原因是

vc6的\VC98\Include\transact.h中的这里
typedef
enum XACT_E
    {    XACT_E_FIRST    = 0x8004d000,
    XACT_E_LAST    = 0x8004d01e,
    XACT_S_FIRST    = 0x4d000,
    XACT_S_LAST    = 0x4d009,
        
和sdk03的Microsoft SDK\include\WinError.h目录中的这里
#define XACT_E_FIRST   0x8004D000
#define XACT_E_LAST    0x8004D029
#define XACT_S_FIRST   0x0004D000
#define XACT_S_LAST    0x0004D010    

有冲突


解决办法:
在stdafx.h中增加如下代码即可

#include <transact.h>

原文地址:https://www.cnblogs.com/vc60er/p/2823679.html