none
I cannot reference a static C++/clr library in other .Net project RRS feed

  • Question

  • I have an unmanaged code that is statically compiled,

    I created a C++/CLR wrapper and reference the unmanaged code through "Add Reference" Option

    I get this error when i build it
    mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease'

    then i changed the configuration option of my C++/CLR wrapper from dll to static....

    But when i try referencing it with a console app, that will consume the api through "Add Reference" > "Project"

    i get this error "cannot add reference" what am i getting wrong in this setup?
    Tuesday, July 2, 2019 7:05 PM

Answers

  • The only supported runtime with /CLR is /MD[d]. Your static library is compiled using /MT so it cannot be linked with /MD projects , with or without CLR.  

    If you have source code of the static library you can recompile it using /MD[d]. If not, write a wrapper DLL for the static library. 



    Visual C++ MVP

    Tuesday, July 2, 2019 9:08 PM

All replies