D8045: cannot compile C file 'serialcommands.c' with the /clr option

纵然是瞬间 提交于 2019-12-01 15:14:09

问题


I am getting compiler error D8045. cannot compile C file 'serialcommands.c' with the /clr option.

This file is a C library that has been written to talk over a serial port to a TI processor. The task that I need to do is wrap this library with a CLR wrapper (there will be additional questions posted to stackoverflow concerning marshalling data back and forth if you want some more easy points from CLI questions.)

I just want to use this C library from my CLR wrapper. I went to Properties->Configuration Properties->C/C++->General->Compile with Common Language runtime support = No Common Language Runtime support

Is this the correct way to do this? Will I experience nasty weird bugs later or are other things that I need to do to use this?


回答1:


Yes. You need to compile any C objects without /CLR, since the clr only understands classes and objects.

You can still use them from your C++/CLI project, wrapped inside of your "ref class" objects. This is a normal way of wrapping a C api in .NET objects.



来源:https://stackoverflow.com/questions/880413/d8045-cannot-compile-c-file-serialcommands-c-with-the-clr-option

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!