Microsoft Visual Studio 2008,版本9.0.30739.1 SP,DLL生成错误

时间:2018-03-27 06:17:02

标签: c++ visual-c++

我正在修改很久以前构建并已使用的现有DLL。我在DLL中添加了新功能,需要使用Echelon Lonworks OpenLDV库来替换旧的32位解决方案。 OpenLDV增加了对32位和64位安装的支持。

当我包含头文件ldv32.h时,我现在得到了很多编译器错误:

    Error   213 error C2146: syntax error : missing ';' before identifier 'ContextRecord'   c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   5545    FsLonPlayer
    Error   214 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   5545    FsLonPlayer
    Error   215 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   5545    FsLonPlayer
    Error   216 error C2065: 'PCONTEXT' : undeclared identifier c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   11263   FsLonPlayer
    Error   217 error C2146: syntax error : missing ')' before identifier 'ContextRecord'   c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   11264   FsLonPlayer
    Error   219 error C2182: 'RtlCaptureContext' : illegal use of type 'void'   c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   11264   FsLonPlayer
    Error   220 error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   11264   FsLonPlayer
    Error   221 error C2059: syntax error : ')' c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   11264   FsLonPlayer
    Error   222 error C3861: '__readfsdword': identifier not found  c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h   12935   FsLonPlayer

我花了很多时间寻找解决方案,更改"创建/使用预编译标题"选项:

    Not Using Precompiled Headers
    Create Precompiled Header (/Yc)
    Use Precompiled Header (/Yu)

每次更改后我都清理了项目并重建,但结果是一样的。

有什么问题?

1 个答案:

答案 0 :(得分:0)

感谢Saliesh的评论,我确实有标题:

    #include <WinDef.h>
    #include <winnt.h>

    #include "ldv32.h"

替换为

    #include <windows.h>

    #include "ldv32.h"

现在编译没有错误。