<future> is not supported when compiling with /clr or /clr:pure

  • Hello.
    I’m trying to use in my Qt project some C# dll, like in this guide:
    http://pragmateek.com/using-c-from-native-c-with-the-help-of-ccli-v2/ .
    I have no problems with native C++ application. But when I’m trying do the same in test Qt console application I have this compilation error:
    error C1190: managed targeted code requires a '/clr' option.
    Ok, for test Qt project I can add this option and it work correctly. But when compile my own application with /clr option I have one more compilation error:
    error C1189: <future> is not supported when compiling with /clr or /clr:pure.
    Why does Qt application requires /clr option and simple C++ app doesn’t? Can I overcome this requirement some way?

  • @kseny

    Hi and welcome to devnet forum

    You need to show the source code and the exact line for the compiler complaint. Otherwise any advice is based on crystal ball reading.

  • Are you using qmake, cmake or visual studio? (spoiler, you can in the latter, not in the former 2)

  • I'm trying with qmake and Visual Studio with same result.

  • In visual studio you can set single .cpp files to be compiled with /clr rather than the entire project. This allows you to avoid conflicts.
    Any cpp file that #includes directly or indirectly <QThread> need to be compiled without the clr flag

  • This post is deleted!

Log in to reply