Is it possible to use to use libs compiled with /MT in C++ CLR? It throws me either a ton of LNK2022 "metadata operation failed (8013118D)" errors (if I use /MD in the CLR project) or " '/MT' and '/clr:pure' command-line options are incompatible" if I use /MT.
What do I need to change in the library? The library is mine, but it includes several third party static libs.
LNK2022 are a pain to pinpoint. It usually means one of your module's configuration affecting structure layout is different from the others.
Check for the following usual causes:
You can use /d1reportSingleClassLayout_your-class-name_ (without space) to get information about the problematic class' layout.
For more information see : Diagnosing Hidden ODR Violations in Visual C++
The only way I found to mix native code static libraries compiled with different crt runtime versions, is to write a DLL that acts like a bridge between the libraries. For example:
your.exe - compiled with /MD and clr yourbridge.dll - native, compiled with /MT and includes all the 3rd party libs built using /MT.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.