I'm trying to compile the below code with the command line compiler but I get a bunch of errors Errors like 'System' is not a class or namespace name
Can the command line compiler be used on this type of code
#include <stdio.h>
#include <stdlib.h>
using namespace System::IO;
using namespace System::Text::RegularExpressions;
void main (void)
{
int index = 0;
String ^line;
Regex^ rx = gcnew Regex(",")
StreamReader^ sr = gcnew StreamReader(testfile.tif);
while ( line = sr->ReadLine() )
{
array<int>^ ia = rx->Split(line);
}
int a=array[index++];
int b=array[index++];
int c=array[index++];
if (a <= 42)
{
b--;
if (c > 1444)
c--;
}
else if (a > 42)
{
do {
a += b;
}
while (b <= 1000);
}
return;
}

Command line compiler help needed!!!!
peterjp
Hi Kybalion,
It looks like you've almost got it. Before your using namespace statements you need to do:
#using <System.dll>
This should enable the the compiler to find the RegularExpressions namespace. And when you're referring to your array, make sure you call it by its declared name "ia" and not "array".
Good luck!
-Jamie Eckman, VC++ Libraries QA
nglow
#using <mscorlib.dll>
Why don't I have to add that to code in the IDE Either way thanks again!
JacksonJones
I've followed every step at: http://msdn2.microsoft.com/en-us/library/ms235639(VS.80).aspx
I'm using the Visual Studio 2005 cl.exe and the command cl /clr test.cpp
At the top of the code I've included:
using namespace System;
using namespace System::IO;
using namespace System::Text::RegularExpressions;
The errors are "RegularExpressions : is not a member of System::Text"
"RegularExpressions : a namespace with this name does not exist"
"'array' : undeclared identifier."
Even though I declared array within the code as "array<int>^ ia = rx->Split(line);"
My Vizai
Mark from NH
Well, you should show us the command line you are using.
Why are you including <stdio.h> and <stdlib.h> Are you trying to mix C and C++/CLI Moreover, both in C and C++ standards, function main() returns int, not void.