我正在修改很久以前构建的现有DLL,并已被使用。我正在为DLL添加新功能,该功能需要使用Echelon Lonworks OpenLDV库来替换旧的32位解决方案。OpenLDV添加了对32位和64位安装的支持。
当我包含标题LDV32.H时,我现在得到很多编译器错误:
Error 213 error C2146: syntax error : missing ';' before identifier 'ContextRecord' c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 5545 FsLonPlayer
Error 214 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 5545 FsLonPlayer
Error 215 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 5545 FsLonPlayer
Error 216 error C2065: 'PCONTEXT' : undeclared identifier c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 11263 FsLonPlayer
Error 217 error C2146: syntax error : missing ')' before identifier 'ContextRecord' c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 11264 FsLonPlayer
Error 219 error C2182: 'RtlCaptureContext' : illegal use of type 'void' c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 11264 FsLonPlayer
Error 220 error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 11264 FsLonPlayer
Error 221 error C2059: syntax error : ')' c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 11264 FsLonPlayer
Error 222 error C3861: '__readfsdword': identifier not found c:program filesmicrosoft sdkswindowsv6.0aincludewinnt.h 12935 FsLonPlayer
我花了很多时间来寻找解决方案,将"创建/使用预编译标头"选项更改为:
Not Using Precompiled Headers
Create Precompiled Header (/Yc)
Use Precompiled Header (/Yu)
每次更改后,我都清理了项目并进行了重建,但结果是相同的。
有什么问题?
谢谢Saliesh的评论,我确实有标题:
#include <WinDef.h>
#include <winnt.h>
#include "ldv32.h"
用
替换 #include <windows.h>
#include "ldv32.h"
现在没有错误编译。