Errors compiling pin tool with python includes, ge

2020-03-26 19:52发布

问题:

I'm trying to compile pin tool with Python.h and am getting more then 100 errors about ambiguous symbols.

I tried to separate the include to different namespace but it generated many other errors.

Same happens when including windows.h.

All the errors looks like:

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

Do you know about a quick fix for this issue?

Thanks!

回答1:

If you want to use the Windows.h header you must use it in its own namespace:

namespace WINDOWS
{
    #include <Windows.h>
}

And then use something from Windows.h by using its namespace:

WINDOWS::DWORD foo; // use WINDOWS namespace

If you don't use a namespace for the windows.h header you'll get tons of name collisions with various headers from PIN itself.

edit:

Just remembered that is was mentioned somewhere on the manual (see: "Conflicts between Pin and Windows"):

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