SDK Compiler error

T

Tony Wilkinson

Hi,

As a complete novice to C# I have fallen at the first hurdle. Sad but
true, I can't get 'Hello World' to work!

I have downloaded the .net SDK etc and installed them on my
workstation as per Microsoft instructions.. I have written the usual
'Hello World' .cs file and then tried to compile it.

I have used the following versions of the commandline syntax to try
and get it to work without any success. Each attempt is separated by
~~~~~~~~~ for ease of reading.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Tony>csc hello1.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.

error CS2001: Source file 'hello1.cs' could not be found
fatal error CS2008: No inputs specified

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Documents and Settings\Tony>csc c:\cs\hello1.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.

c:\CS\hello1.cs(8,9): error CS1003: Syntax error, '(' expected
c:\CS\hello1.cs(8,15): error CS1026: ) expected

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The file is where it is stated. Quite where the '(' & ')' are
expected is anyones guess.

Can anyone help please. The help via /? is useless in this instance.

Many thanks,

Tony W
 
F

Francois Beaussier

:
Hi,

As a complete novice to C# I have fallen at the first hurdle. Sad but
true, I can't get 'Hello World' to work!

I have downloaded the .net SDK etc and installed them on my
workstation as per Microsoft instructions.. I have written the usual
'Hello World' .cs file and then tried to compile it.

Can you post the code you wrote ?

try the following :

using System;

namespace Test
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("Hello world");
}
}
}
 
T

Tony W

Francois,

Thankyou for your help.

I copied your code and it compiled OK.

Went back to my code and found my declaration for using System
Namespace was in the wrong place. After much searching also found a
few carriage returns after my closing curly bracket.

All now working OK.

Thanks again,
Tony W

:
Hi,

As a complete novice to C# I have fallen at the first hurdle. Sad but
true, I can't get 'Hello World' to work!

I have downloaded the .net SDK etc and installed them on my
workstation as per Microsoft instructions.. I have written the usual
'Hello World' .cs file and then tried to compile it.

Can you post the code you wrote ?

try the following :

using System;

namespace Test
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("Hello world");
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top