有人可以帮我找到以下错误的解决方案:
“致命错误 C1190:托管目标代码需要 '/clr' 选项”
我的配置是..
- 视觉工作室 2008
- Windows 7的
这是代码(我通过使用网络资源获得)
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
int main() {
// Create a reference to the current directory.
DirectoryInfo* di = new DirectoryInfo(Environment::CurrentDirectory);
// Create an array representing the files in the current directory.
FileInfo* fi[] = di->GetFiles();
Console::WriteLine(S"The following files exist in the current directory:");
// Print out the names of the files in the current directory.
Collections::IEnumerator* myEnum = fi->GetEnumerator();
while (myEnum->MoveNext()) {
FileInfo* fiTemp = __try_cast<FileInfo*>(myEnum->Current);
Console::WriteLine(fiTemp->Name);
}
}