【问题标题】:Errors compiling pin tool with python includes, getting error C2872: 'UINT32' : ambiguous symbol使用 python 编译 pin 工具的错误包括,得到错误 C2872: 'UINT32' : ambiguous symbol
【发布时间】:2015-03-17 10:20:44
【问题描述】:

我正在尝试使用 Python.h 编译 pin 工具,但出现了 100 多个关于不明确符号的错误。

我试图将include 分离到不同的命名空间,但它产生了许多其他错误。

包含windows.h 时也会发生同样的情况。

所有错误看起来像:

D:\proj\Pin\source\include\pin\gen\types_core.TLH(67): error C2872: 'INT32' : ambiguous symbol could be 'C:\Program Files (x86)\Windows Kits\8.0\Include\shared\basetsd.h(72) : int INT32 or D:\proj\pin\Pin\source\include\pin\gen\types_foundation.TLH(88) : LEVEL_BASE::INT32' D:\proj\pin\Pin\source\include\pin\gen\types_core.TLH(81) : see reference to class template instantiation 'LEVEL_CORE::INDEX<dummy>' being compiled

您知道此问题的快速解决方法吗?

谢谢!

【问题讨论】:

    标签: python c++ visual-studio compiler-errors intel-pin


    【解决方案1】:

    如果你想使用 Windows.h 头文件,你必须在它自己的命名空间中使用它:

    namespace WINDOWS
    {
        #include <Windows.h>
    }
    

    然后通过使用它的命名空间来使用 Windows.h 中的一些东西:

    WINDOWS::DWORD foo; // use WINDOWS namespace
    

    如果您不为 windows.h 标头使用命名空间,您将与来自 PIN 本身的各种标头发生大量名称冲突。

    编辑

    只记得手册某处提到过(请参阅:“Pin 和 Windows 之间的冲突”):

    https://software.intel.com/sites/landingpage/pintool/docs/65163/Pin/html/index.html#RESTRICTIONS

    【讨论】:

    • 重新定义所有对 UINT32 的 PIN 或 Python 引用将是一场地狱......必须有更好的方法来做到这一点。
    • @user1618465 我认为您误解了我的答案或 PIN 文件:您不必重新定义 inside PIN、Windows 或 python 标头(或其他)的类型。只需在 your Pintool 中使用命名空间。那是完全不同的......
    猜你喜欢
    • 1970-01-01
    • 2014-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 2017-09-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多