Gå til innhold

C#: Hvordan compile? Trenger hjelp... Haster!


Anbefalte innlegg

Hei! Jeg har akkurat begynt med C# og har skaffet en bok. Der står det hvordan man skal compile, men bare i visual studio. Jeg har Visual C# 2005 express edition. Som compiler har jeg SharpDevelop. Noen som vet hvordan jeg compiler?

 

Tusen takk for svar :) Trenger svar helst litt kjappt. Jeg reiser i morgen...

 

Har lest det om og om igjen, men jeg skjønner det bare ikke...

 

Her er teksten som står i boken:

 

Once you save your program to disk, you must compile the code to create your application. Compiling your source code means running a compiler and identifying the source code file. You run the compiler by opening a command prompt (DOS box) and entering the program name csc. Then you "pass in" your source code file by entering the filename on the command line, as in the following:

 

    csc HelloWorld.cs

 

 

The job of the compiler is to turn your source code into a working program. It turns out to be just slightly more complicated than that because .NET uses an intermediate language called Microsoft Intermediate Language (MSIL, sometimes abbreviated as IL).

 

The compiler reads your source code and produces IL. When you run the program, the .NET Just In Time (JIT) compiler reads your IL code and produces an executable application in memory.

 

Microsoft provides a command window with the correct environment variables set. Open the command window by selecting the following menu items in this order (your installation may vary slightly): Start  Programs  Microsoft Visual Studio 2005  Visual Studio Tools  Visual Studio 2005 Command Prompt.

 

Navigate to the directory in which you created your code file and enter the following command:

 

    csc helloworld.cs

 

 

The Microsoft C# compiler compiles your code; when you display the directory, you'll find the compiler has produced an executable file called helloworld.exe. Type helloworld at the command prompt, and your program executes, as shown in Figure 1-4.

 

Presto! You are a C# programmer. That's it, close the book, you've done it. Okay, don't close the bookthere are details to examine, but take a moment to congratulate yourself.

Endret av Rinox
Lenke til kommentar
Videoannonse
Annonse

Takk :) Skulle på ferie, men klarte å å debugge og compile før jeg dro. Nå er jeg på kapittel 6 i boken :) Gleder meg til å programmere :) Har drevet litt med python før så jeg oppdaget noen likheter innimellom, men de er vel felles for nesten alle programmeringsspråk :)

Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
×
×
  • Opprett ny...