如何使用 Directory.GetFiles
我想使用 Directory.GetFiles 从文件夹中读取文件。从msdn网站我发现: 对于 c,我有 include:
using System;
using System.IO;
对于 C++,我有 include:
#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
请帮助我。温度
I want to use Directory.GetFiles to read files from a folder. From msdn website i found:
For c, i have include:
using System;
using System.IO;
For C++, i have include:
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
as header.
For the C++, after the line #using is added, the "fatal error C1190: managed targeted code requires a '/clr' option" appears. So i tried by adding /clr in the visual studio Properties\Linker\Command Line as i found it in other website, but i fail too.
I did it wrongly. So, How to handle error of "fatal error C1190: managed targeted code requires a '/clr' option"? How to "compile with the /clr flag"?
Because i am writing for OpenCv, i have include the following additional dependencies in order to use c and c++:
cv210d.lib
cxcore210d.lib
highgui210d.lib
cvaux210d.lib
Cannot work. What other requirements in order to use Directory.GetFiles?
I also cannot use foreach even i #include .
Is there something similar to use foreach and Directory.GetFiles which is necessary to be included in a project?
I am using Visual Studio 2008
Please help me. Tq
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要创建托管 c++ CLI,这应该包括您的所有标志。
要从 Visual Studio 设置 /clr,请转到项目属性 -> 配置属性 -> 将公共语言运行时支持设置为 /clr
You need to create managed c++ CLI, this should include all the flags for you.
To set /clr from visual studio, go to porject properities->configurations properities->general set common language runtime support to /clr