【问题标题】:How to use Directory.GetFiles如何使用 Directory.GetFiles
【发布时间】:2011-08-03 20:18:55
【问题描述】:

我想使用 Directory.GetFiles 从文件夹中读取文件。从msdn网站我发现: 对于 c,我包括:

using System;
using System.IO;

对于 C++,我有包括:

#using <mscorlib.dll>
using namespace System;
using namespace System::IO;

作为标题。

对于 C++,在添加 #using 行后,会出现“致命错误 C1190:托管目标代码需要 '/clr' 选项”。所以我尝试在 Visual Studio Properties\Linker\Command Line 中添加 /clr,因为我在其他网站上找到了它,但我也失败了。

我做错了。那么,如何处理“致命错误C1190:托管目标代码需要'/clr'选项”的错误?如何“使用 /clr 标志编译”?

因为我是为 OpenCv 编写的,所以为了使用 c 和 c++,我包含了以下附加依赖项:

cv210d.lib

cxcore210d.lib

highgui210d.lib

cvaux210d.lib

无法工作。使用 Directory.GetFiles 的其他要求是什么? 即使我 #include 我也不能使用 foreach 。 有没有类似于使用 foreach 和 Directory.GetFiles 的东西,必须包含在项目中?

我正在使用 Visual Studio 2008

请帮助我。时间

【问题讨论】:

    标签: c++ c programming-languages opencv


    【解决方案1】:

    您需要创建托管的 c++ CLI,这应该包括您的所有标志。 要从 Visual Studio 设置 /clr,请转到 porject properties->configurations properties->general set common language runtime support to /clr

    【讨论】:

      猜你喜欢
      • 2010-11-27
      • 1970-01-01
      • 2011-12-04
      • 1970-01-01
      • 2019-07-04
      • 1970-01-01
      • 2010-09-08
      • 2016-03-01
      • 2017-07-14
      相关资源
      最近更新 更多