Using mex to compile with \clr option

12 Ansichten (letzte 30 Tage)
jenn
jenn am 5 Mai 2015
Bearbeitet: Yudha Pane am 19 Jul. 2015
I am trying to call a custom C++ library from Matlab. I can build this library in Visual Studio 2010 and run just fine. However, when I try to build with mex to call from Matlab I get the following fatal error:
C1190: managed targeted code requires a'/clr' option
I cannot tell in the mex documentation if adding this compiler flag is doable. Or what my options are to talk with this C++ library.
Help!

Akzeptierte Antwort

James Tursa
James Tursa am 5 Mai 2015
Bearbeitet: James Tursa am 5 Mai 2015
Adding a compiler flag to the mex process can be accomplished like this:
filename = your source code file name
compiler_option = '/clr';
mex(filename,['COMPFLAGS="$COMPFLAGS ' compiler_option '"']);
  1 Kommentar
Yudha Pane
Yudha Pane am 19 Jul. 2015
Bearbeitet: Yudha Pane am 19 Jul. 2015
Hi James. I have the same problem and already tried your suggestion. However, another error pops out:
"cl : Command line error D8016 : '/EHs' and '/clr' command-line options are incompatible"
I was trying to compile a mex file which includes a CLR c++ source code. Could you point out in which part I am doing it wrong?
Thanks a lot

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Call C++ from MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by