简体   繁体   English

在C ++ / CLR项目中使用C ++ DLL库项目

[英]Use C++ DLL library project in C++ /CLR project

I'm trying to use a unmanaged C++ DLL library project in a C++ /CLR managed wrapper project, but because the unmanaged project uses <thread> the managed project won't build: error C1189: #error : <thread> is not supported when compiling with /clr or /clr:pure. 我正在尝试在C ++ / CLR托管包装器项目中使用非托管C ++ DLL库项目,但是由于非托管项目使用<thread> ,因此无法构建托管项目: error C1189: #error : <thread> is not supported when compiling with /clr or /clr:pure.

to be clear: the managed project itself does NOT use <thread> , only the referenced unmanaged 要明确:管理项目本身使用<thread>仅引用的非托管

Is there anyway I can use threads in the unmanaged project and still have it interact properly with the managed wrapper project? 无论如何,我可以在非托管项目中使用线程,并且仍使其与托管包装器项目正确交互吗? (changing the project nature to use managed threads is not an option) (更改项目性质以使用托管线程不是一种选择)


Edit: I received -2. 编辑:我收到-2。 I'm not sure why, I couldn't find anything for this specific case and I have no idea what is wrong exactly but it seems like the managed project is also compiling the unmanaged project? 我不确定为什么,在这种情况下我找不到任何东西,我也不知道到底是什么问题,但是托管项目似乎也在编译非托管项目?

Does the include file for the unmanaged project include <thread> , directly or indirectly? 非托管项目的包含文件是否直接或间接包含<thread> That's probably the cause of the error. 这可能是错误的原因。

Try to make the interface header of the unmanaged project just define the interface, and not include any implementation-dependent include files. 尝试使非托管项目的接口标头仅定义接口,而不包括任何与实现相关的包含文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM