Tuesday, 4 December 2007

My second attempt using C++ on Visual studio 2005

#include
"stdafx.h"


 

#using
<mscorlib.dll>

using
namespace System;

int _tmain(int argc, _TCHAR* argv[])

{

    Console::WriteLine("Welcome to visual C++");

    return 0;

}

Well, yes that was the piece of code I was stuck on and because I was using Vista, I thought it's not completely updated or something. The error message I was getting was:

fatal error C1190: managed targeted code requires '#using ' and '/clr' option

I don't know what /clr is or "Common Language Runtime", I might write it down here later when I figure out. Anyway to fix this you need to change Common Language Runtime option which right now is not set. That's why you're getting an error.

To fix it (in Visual Studio 2005) right click on the project name in the solution menu and choose properties. In the General sort of tab thing change the value of "Common Language Runtime support" to what ever you want, "Pure MSIL Common Language Runtime Support (/clr pure)" worked for me

No comments: