gpt4 book ai didi

c# - 'csc' 不是内部或外部命令,也不是可运行的程序或批处理文件

转载 作者:太空狗 更新时间:2023-10-29 18:09:05 26 4
gpt4 key购买 nike

<分区>

我是 C# 的新手,我正在尝试使用 cmd 编译一个名为 test.cs 的基本 hello world 文件。它包含以下内容:

// Similar to #include<foo.h> in C++, includes system namespaces in a program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

// A name space declaration, a class is a group of namespaces
namespace Program1
{
class Hello // my class here, classes can contain multiple functions called methods which define it's behavior
{
static void Main(string[] args) // main method, just like in C/C++ it's the starting point for execution cycle
{
Console.WriteLine("Hello World");
Console.ReadKey(); // similar to _getch() in C++ waits for user to input something before closing
}
}
}

/*
* Other notes, .cs is a c# file extension
* cs files can be built via terminal by using csc foo.cs to generate foo.exe run it with foo
*/

当我尝试运行 csc test.cs 行时,我得到以下输出: img of issue

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com