Can someone help me find a solution to the following error:
"fatal error C1190: managed targeted code requires a '/clr' option"
My configuration is ..
- Visual studio 2008
- Windows 7
Here is the code (i got by using net resources)
#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);
}
}