'csc' is not recognized as an internal or external command, operable program or batch file
本问题已经有最佳答案,请猛点这里访问。
我对C还比较陌生,我正在尝试使用cmd编译一个名为
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | // 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.exe的路径并将其添加到您的
在我的例子中,64位C编译器的路径是
同样,您可以在不同的.NET框架版本目录下的
所有版本都有csc.exe,如v2.0.xxxxx和v3.5。根据需要选择framework64/framework目录中版本最高的版本。
复制csc.exe的路径并将其添加到path系统环境变量中。
退出命令,然后再次启动并运行程序。那就行了。