c命令行编译器命令
‘壹’ win8怎么使用c#命令行编译器详细介绍
csc.exe是.NET Framework SDK中的一个工具,当然用VS舒服多了...
不怕麻烦或者小硬盘的可以用用看,下面是些基本编辑,编译,调试操作(很不详细,详细请看MSDN :) ):
1.配置C#命令行编辑器:
我的电脑 - 属性 - 高级 - 环境变量 - 系统变量列表对话框 - 双击Path变量 -
在当前路径值的末尾加入(路径变量里各值用分号区隔): C:\Windows\Microsoft.NET\Framework\v2.0.50727 (注意,路径和版本号会因为你的安装和下载的不同而不同,自己到安装目录下看看)
如果配置成功,在命令窗口中输入: csc /? 将显示C#编译器支持的选项列表.
2.配置其他.NET命令行工具:
将附加路径变量加入系统变量列表框: C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
如果配置成功,在命令窗口中输入:gacutil /? 查看GAC工具gacutil.exe的各个选项.
3.使用csc.exe和记事本构建C#应用程序:
- 使用记事本编辑源代码,并保存为.cs格式,如TestApp.cs,存储路径C:\CscExample\
//TestApp.cs
using System;
class TestApp
{
public static void Main()
{
Console.WriteLine("Testing!");
}
}
‘贰’ visual studio中用什么命令编译c语言
命令是cl
比如你要编译main.c
就是 cl main.c
只要安装了Visual Studio都会带命令行工具,帮你把需要的库,头文件,编译器都临时加入环境变量 ,不需要自己设置,也不用在环境变量里加一堆值

‘叁’ 如何在命令行中使用intel c++编译器,并使用openmp和mkl来编译自己的程序,并运算
1、icc
Intel C/C++编译器接受遵守ANSI C/C++ , ISO C/C++ standards,GNU inline ASM for IA-32 architecture标准的输入。与linux下常用的gcc兼容并支持更大的C语言扩展,包括源文件、命令行参数、目标文件。不支持gcc的inline方式的汇编。例,f.c
#include<stdio.h>
int main(int argc, char* argv[]){
printf("Hello\n");
return 0;
}
编译:icc -c f.cpp -o f.o
链接:icc f.o -o f
运行:./f
注意,编译与链接都由icc来完成,icc常用命令行参数:
-o 输出文件命名
-I include路径
-L lib路径
-l 包含的lib名
-c 仅生成目标文件(*.o),不链接
-On n=0,1,2,3 编译器优化选项,n=0关闭编译器优化,n=3使用最激进的优化
-c99[-] 打开/关闭 c99规范的支持
详细的请参照icc的manpage.
2、ifort
Intel Fortran编译器支持F77/90/95标准并与CFV(Compaq Visual Fortran)兼容。例,f.f90
program f
print *, "Hello"
stop
end
编译:ifort -c f.f90 -o f.o
链接:ifort f.o -o f
运行:./f
编译与连接同样由ifort来完成,ifort常用命令行参数:
-o 输出文件命名
-I include路径
-L lib路径
-l 包含的lib名
-c 仅生成目标文件(*.o),不链接
-On n=0,1,2,3 编译器优化选项,n=0关闭编译器优化,n=3使用最激进的优化
-std90 使用F90标准编译
-std95 使用F 95标准编译
-f77rtl 编译使用F77运行方式的代码(用于解决特殊问题)
These options optimize application performance for a particular Intel? processor or family of processors. The compiler generates code that takes advantage of features of the specified processor.
Option
Description
tpp5 or G5 Optimizes for Intel? Pentium? and Pentium? with MMX? technology processors.
tpp6 or G6 Optimizes for Intel? Pentium? Pro, Pentium? II and Pentium? III processors.
tpp7 or G7 Optimizes for Intel? Pentium? 4, Intel? Xeon?, Intel? Pentium? M processors, and Intel? Pentium? 4 processors with Streaming SIMD Extensions 3 (SSE3) instruction support.
On Intel? EM64T systems, only option tpp7 (Linux) or G7 (Windows) is valid.
About tpp:
http://www.ncsa.illinois.e/UserInfo/Resources/Software/Intel/Compilers/9.0/main_for/mergedProjects/copts_for/common_options/option_tpp567_g567.htm
https://wiki.ke.e/display/SCSC/Compilers+and+Libraries
Intel Fortran Compiler Options: http://geco.mines.e/guide/ifort.html
Intel(R) Fortran Compiler Options: http://www.rcac.pure.e/userinfo/resources/common/compile/compilers/intel/man/ifort.txt
ifort编译器提供了非常多的优化参数
$ ifort --help | more 查看就可以
也可以定位到某个参数
$ifort --help | grep -5 '-mkl'
-5表示显示查找到的行及下面5行的内容。
3、Intel MKL数学库针对Intel系列处理器进行了专门的优化,主要包含的库有:
基本线形代数运算(BLAS)
向量与向量、向量与矩阵、矩阵与矩阵的运算
稀疏线形代数运算
快速傅立叶变换(单精度/双精度)
LAPACK(求解线形方程组、最小方差、特征值、Sylvester方程等)
向量数学库(VML)
向量统计学库(VSL)
高级离散傅立叶变换
编译:
icc multi.c -I/opt/intel/mkl/include –L/intel/mkl/lib –lmpi_ipf –o multi
4、MPI程序编译
消息传递接口(MPI)并行程序设计模型程序的编译命令。例,f.c
include<stdio.h>
#include<mpi.h>
main(argc,argv)
int argc;
char *argv[];
{
char name[BUFSIZ];
int length;
MPI_Init(&argc,&argv);
MPI_Get_processor_name(name, &length);
printf("%s: hello world\n", name);
MPI_Finalize();
}
编译与连接均使用mpicc,参数与mpicc中定义的编译器相同,这里与icc相同。
mpicc –c hello.c –o hello.o
mpicc hello.o –o hello
运行使用mpirun 命令,将运行需要的节点定义在文件中并在-machinfile中制定。
文件: nodelist
node1
node1
node2
node3
运行:
$mpirun –machefile nodelist –np 4 ./hello
node1: hello world
node1: hello world
node2: hello world
node3: hello world
5、32位向64位的移植
32位程序到64位移植中应注意的常见问题:
数据截断:
由于long类型变量的运算(赋值、比较、移位等)产生。long定义在x86上为32bits,而在ia64上为64bits.容易在与int型变量运算时出现异常。
处理方法:尽量避免不同类型变量间的运算,避免将长度较长的变量赋值到较短的变量中,统一变量长度可以解决这个问题。简单的对于32位转移到64位可以将所有long定义转换为int定义。
‘肆’ 在C语言编译器目录下执行如下命令
BGI 驱动程序C源代码
把文件都放到TC目录下执行到命令提示符执行这个命令就偶了。
就像执行汇编的masm命令一样。试试吧,这个我也没用过。
javac的用法:
SYNOPSIS
Javac [ options ] [ sourcefiles ] [ @argfiles ]
Arguments may be in any order.
options :Command-line options.
sourcefiles :One or more source files to be compiled (such as MyClass.java).
@argfiles :One or more files that lists options and source files. The -J options are not allowed in these files.
DESCRIPTION
The javac tool reads class and interface definitions, written in the Java programming language, and compiles them into bytecode class files.
There are two ways to pass source code file names to javac:
For a small number of source files, simply list the file names on the command line.
For a large number of source files, list the the file names in a file, separated by blanks or line breaks. Then use the list file name on the javac command line, preceded by an @ character.
Source code file names must have .java suffixes, class file names must have .class suffixes, and both source and class files must have root names that identify the class. For example, a class called MyClass would be written in a source file called MyClass.java and compiled into a bytecode class file called MyClass.class.
Inner class definitions proce additional class files. These class files have names combining the inner and outer class names, such as MyClass$MyInnerClass.class.
You should arrange source files in a directory tree that reflects their package tree. For example, if you keep all your source files in /workspace, the source code for com.mysoft.mypack.MyClass should be in /workspace/com/mysoft/mypack/MyClass.java.
By default, the compiler puts each class file in the same directory as its source file. You can specify a separate destination directory with -d (see Options, below).
SEARCHING FOR TYPES
When compiling a source file, the compiler often needs information about a type it does not yet recognize. The compiler needs type information for every class or interface used, extended, or implemented in the source file. This includes classes and interfaces not explicitly mentioned in the source file but which provide information through inheritance.
For example, when you subclass java.Applet.Applet, you are also using Applet's ancestor classes: java.awt.Panel, java.awt.Container, java.awt.Component, and java.awt.Object.
When the compiler needs type information, it looks for a source file or class file which defines the type. The compiler searches first in the bootstrap and extension classes, then in the user class path. The user class path is defined by setting the CLASSPATH environment variable or by using the -classpath command line option. (For details, see Setting the Class Path). If you use the -sourcepath option, the compiler searches the indicated path for source files; otherwise the compiler searches the user class path both for class files and source files. You can specify different bootstrap or extension classes with the -bootclasspath and -extdirs options; see Cross-Compilation Options below.
A successful type search may proce a class file, a source file, or both. Here is how javac handles each situation:
Search proces a class file but no source file: javac uses the class file.
Search proces a source file but no class file: javac compiles the source file and uses the resulting class file.
Search proces both a source file and a class file: javac determines whether the class file is out of date. If the class file is out of date, javac recompiles the source file and uses the updated class file. Otherwise, javac just uses the class file.
javac considers a class file out of date only if it is older than the source file.
Note that javac can silently compile source files not mentioned on the command line. Use the -verbose option to trace automatic compilation.
OPTIONS
The compiler has a set of standard options that are supported on the current development environment and will be supported in future releases. An additional set of non-standard options are specific to the current virtual machine and compiler implementations and are subject to change in the future. Non-standard options begin with -X.
Standard Options
-classpath classpath
Set the user class path, overriding the user class path in the CLASSPATH environment variable. If neither CLASSPATH or -classpath is specified, the user class path consists of the current directory. See Setting the Class Path for more details.
If the -sourcepath option is not specified, the user class path is searched for source files as well as class files.
-d directory
Set the destination directory for class files. The destination directory must already exist; javac will not create the destination directory. If a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed. For example, if you specify -d /home/myclasses and the class is called com.mypackage.MyClass, then the class file is called /home/myclasses/com/mypackage/MyClass.class.
If -d is not specified, javac puts the class file in the same directory as the source file.
Note that the directory specified by -d is not automatically added to your user class path.
-deprecation
Show a description of each use or override of a deprecated member or class. Without -deprecation, javac shows the names of source files that use or override deprecated members or classes.
-encoding encoding
Set the source file encoding name, such as EUCJIS/SJIS. If -encoding is not specified, the platform default converter is used.
-g
Generate all debugging information, including local variables. By default, only line number and source file information is generated.
-g:none
Do not generate any debugging information.
-g:{keyword list}
Generate only some kinds of debugging information, specified by a comma separated list of keywords. Valid keywords are:
source
Source file debugging information
lines
Line number debugging information
vars
Local variable debugging information
-help
Print a synopsis of standard options.
-nowarn
Disable warning messages.
-source release
Enables support for compiling source code containing assertions.
When release is set to 1.4, the compiler accepts code containing assertions. Assertions were introced in J2SE 1.4.
When release is set to 1.3, the compiler does not support assertions. The compiler defaults to the 1.3 behavior if the -source flag is not used.
-sourcepath sourcepath
Specify the source code path to search for class or interface definitions. As with the user class path, source path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives. If packages are used, the local path name within the directory or archive must reflect the package name.
Note that classes found through the classpath are subject to automatic recompilation if their sources are found.
-verbose
Verbose output. This includes information about each class loaded and each source file compiled.
Cross-Compilation Options
By default, classes are compiled against the bootstrap and extension classes of the platform that javac shipped with. But javac also supports cross-compiling, where classes are compiled against a bootstrap and extension classes of a different Java platform implementation. It is important to use -bootclasspath and -extdirs when cross-compiling; see Cross-Compilation Example below.
-target version
Generate class files that will work on VMs with the specified version. The default is to generate class files to be compatible with the 1.2 VM in the Java 2 SDK, with one exception. When the -source 1.4 option is used, the default target is 1.4. The versions supported by javac are:
1.1
Ensure that generated class files will be compatible with 1.1 and VMs in the Java 2 SDK.
1.2
Generate class files that will run on VMs in the Java 2 SDK, v 1.2 and later, but will not run on 1.1 VMs. This is the default.
1.3
Generate class files that will run on VMs in the Java 2 SDK, v 1.3 and later, but will not run on 1.1 or 1.2 VMs.
1.4
Generate class files that are compatible only with 1.4 VMs.
-bootclasspath bootclasspath
Cross-compile against the specified set of boot classes. As with the user class path, boot class path entries are separated by colons (:) and can be directories, JAR archives, or ZIP archives.
-extdirs directories
Cross-compile against the specified extension directories. Directories is a colon-separated list of directories. Each JAR archive in the specified directories is searched for class files.
Non-Standard Options
-X
Display information about non-standard options and exit.
-Xstdout filename
Send compiler messages to the named file. By default, compiler messages go to System.err.
-Xswitchcheck
Checks switch blocks for fall-through cases and provides a warning message for any that are found. Fall-through cases are cases in a switch block, other than the last case in the block, whose code does not include a break statement, allowing code execution to "fall through" from that case to the next case. For example, the code following the case 1 label in this switch block does not contain a break statement:
switch (x) {
case 1:
System.out.println("1");
// No break; statement here.
case 2:
System.out.println("2");
}
If the -Xswtichcheck flag were used when compiling this code, the compiler would emit a warning about "possible fall-through into case," along with the line number of the case in question.
The -J option
-Joption
Pass option to the java launcher called by javac. For example, -J-Xms48m sets the startup memory to 48 megabytes. Although it does not begin with -X, it is not a `standard option' of javac. It is a common convention for -J to pass options to the underlying VM executing applications written in Java.
Note that CLASSPATH, -classpath, -bootclasspath, and -extdirs do not specify the classes used to run javac. Fiddling with the implementation of the compiler in this way is usually pointless and always risky. If you do need to do this, use the -J option to pass through options to the underlying java launcher.
COMMAND LINE ARGUMENT FILES
To shorten or simplify the javac command line, you can specify one or more files that themselves contain arguments to the javac command (except -J options). This enables you to create javac commands of any length on any operating system.
An argument file can include javac options and source filenames in any combination. The arguments within a file can be space-separated or newline-separated. Filenames within an argument file are relative to the current directory, not the location of the argument file. Wildcards (*) are not allowed in these lists (such as for specifying *.java). Use of the '@' character to recursively intERPret files is not supported. The -J options are not supported because they are passed to the launcher, which does not support argument files.
When executing javac, pass in the path and name of each argument file with the '@' leading character. When javac encounters an argument beginning with the character `@', it expands the contents of that file into the argument list.
Example - Single Arg File
You could use a single argument file named "argfile" to hold all javac arguments:
C:> javac @argfile
This argument file could contain the contents of both files shown in the next example.
Example - Two Arg Files
You can create two argument files -- one for the javac options and the other for the source filenames: (Notice the following lists have no line-continuation characters.)
Create a file named "options" containing:
-d classes
-g
-sourcepath \java\pubs\ws\1.3\src\share\classes
Create a file named "classes" containing:
MyClass1.java
MyClass2.java
MyClass3.java
You would then run javac with:
C:> javac @options @classes
Example - Arg Files with Paths
The argument files can have paths, but any filenames inside the files are relative to the current working directory (not path1 or path2):
C:> javac @path1\options @path2\classes
EXAMPLES
Compiling a Simple Program
One source file, Hello.java, defines a class called greetings.Hello. The greetings directory is the package directory both for the source file and the class file and is off the current directory. This allows us to use the default user class path. It also makes it unnecessary to specify a separate destination directory with -d.
% ls
greetings/
% ls greetings
Hello.java
% cat greetings/Hello.java
package greetings;
public class Hello {
public static void main(String[] args) {
for (int i=0; i < args.length; i++) {
System.out.println("Hello " + args[i]);
}
}
}
% javac greetings/Hello.java
% ls greetings
Hello.class Hello.java
% java greetings.Hello World Universe Everyone
Hello World
Hello Universe
Hello Everyone
Compiling Multiple Source Files
This example compiles all the source files in the package greetings.
% ls
greetings/
% ls greetings
Aloha.java GutenTag.java Hello.java Hi.java
% javac greetings/*.java
% ls greetings
Aloha.class GutenTag.class Hello.class Hi.class
Aloha.java GutenTag.java Hello.java Hi.java
Specifying a User Class Path
Having changed one of the source files in the previous example, we recompile it:
% pwd
/examples
% javac greetings/Hi.java
Since greetings.Hi refers to other classes in the greetings package, the compiler needs to find these other classes. The example above works, because our default user class path happens to be the directory containing the package directory. But suppose we want to recompile this file and not worry about which directory we're in? Then we need to add /examples to the user class path. We can do this by setting CLASSPATH, but here we'll use the -classpath option.
% javac -classpath /examples /examples/greetings/Hi.java
If we change greetings.Hi again, to use a banner utility, that utility also needs to be Accessible through the user class path.
% javac -classpath /examples:/lib/Banners.jar \
/examples/greetings/Hi.java
To execute a class in greetings, we need access both to greetings and to the classes it uses.
% java -classpath /examples:/lib/Banners.jar greetings.Hi
Separating Source Files and Class Files
It often makes sense to keep source files and class files in separate directories, especially on large projects. We use -d to indicate the separate class file destination. Since the source files are not in the user class path, we use -sourcepath to help the compiler find them.
% ls
classes/ lib/ src/
% ls src
farewells/
% ls src/farewells
Base.java GoodBye.java
% ls lib
Banners.jar
% ls classes
% javac -sourcepath src -classpath classes:lib/Banners.jar \
src/farewells/GoodBye.java -d classes
% ls classes
farewells/
% ls classes/farewells
Base.class GoodBye.class
Note that the compiler compiled src/farewells/Base.java, even though we didn't specify it on the command line. To trace automatic compiles, use the -verbose option.
Cross-Compilation Example
Here we use the Java 2 SDK javac to compile code that will run on a 1.1 VM.
% javac -target 1.1 -bootclasspath JDK1.1.7/lib/classes.zip \
-extdirs "" OldCode.java
The -target 1.1 option ensures that the generated class files will be compatible with 1.1 VMs. In the Java 2 SDK javac compiles for 1.2 by default.
The Java 2 SDK's javac would also by default compile against its own bootstrap classes, so we need to tell javac to compile against JDK 1.1 bootstrap classes instead. We do this with -bootclasspath and -extdirs. Failing to do this might allow compilation against a Java 2 Platform API that would not be present on a 1.1 VM and fail at runtime.
‘伍’ c语言命令行程序如何在DOS下编译运行
1、打开开始,运行cmd,进入dos界面。

‘陆’ 如何在cmd中编译命名运行c程序
只要安装了可以命令行运行的编译器就可以,例如安装mingw里面的gcc编译器,就可以在命令行下运行:
C:UsersMSI>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=e:/mingw/bin/../libexec/gcc/mingw32/9.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-9.2.0/configure --build=x86_64-pc-linux-gnu --host=m
ingw32 --target=mingw32 --disable-win32-registry --with-arch=i586 --with-tune=ge
neric --enable-static --enable-shared --enable-threads --enable-languages=c,c++,
objc,obj-c++,fortran,ada --with-dwarf2 --disable-sjlj-exceptions --enable-versio
n-specific-runtime-libs --enable-libgomp --disable-libvtv --with-libiconv-prefix
=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --disable-build-fo
rmat-warnings --prefix=/mingw --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/m
ingw --with-isl=/mingw --enable-nls --with-pkgversion='MinGW.org GCC Build-2'
Thread model: win32
gcc version 9.2.0 (MinGW.org GCC Build-2)
‘柒’ linux 怎么编译c的源程序的gcc,编译命令是什么
在Linux下面,如果要编译一个C语言源程序,我们要使用gcc编译器。
先将源文件编译成目标文件:gcc - c hello.c
生成hello.o文件,再将目标文件编译成可执行文件:gcc -o hello hello.o
如:
int main(int argc,char **argv)
{
printf("Hello Linux ");
}

(7)c命令行编译器命令扩展阅读:
在使用GCC编译器的时候,我们必须给出一系列必要的调用参数和文件名称。GCC编译器的调用参数大约有100多个,这里只介绍其中最基本、最常用的参数。具体可参考GCC Manual。
GCC最基本的用法是∶gcc [options] [filenames]
其中options就是编译器所需要的参数,filenames给出相关的文件名称。
网络_gcc
‘捌’ 如何用命令行 cmd 编译运行c c 程序
Windows系统下编译连接源代码方法:
cl -GX test.c
-GX: 启动同步异常处理
上面的命令会产生可执行程序:test.exe
在命令行中直接输入:test.exe 就可运行该程序
Tips:
一、cmd中键入cl提示不认识cl命令,则由于无法找到cl.exe程序。解决方法如下:
添加系统变量(Path),这样:我的电脑->属性->高级->环境变量->系统变量,在path中添加
C:/Program Files/Microsoft Visual Studio 9.0/VC/bin;。
注意:
1、结尾最后用“;”隔开!
2、如果你的Microsoft Visual Studio 低于9.0版本或高于9.0版需要修改上面的路径名称。
二、cmd中键入cl执行编译时会出现mspdb80.dll无法找到的情况,是因为VC/Bin/下没有 “msobj80.dll,
mspdb80.dll,mspdbcore.dll,mspdbsrv.exe”这四个文件,解决的方法:
1>直接从Common7/IDE/下复制这四个文件到VC/Bin/下即可解决
2>添加系统变量(Path),这样:我的电脑->属性->高级->环境变量->系统变量,在path中添加 C:/Program Files/Microsoft Visual Studio 8/Common7/IDE;,注意结尾最后用“;”隔开!
这样在用cl编译就不会出现mspdb80.dll文件找不到的错误了。
‘玖’ linux 怎么编译c的源程序的gcc,编译命令是什么
在Linux下面,如果要编译一个C语言源程序,我们要使用gcc编译器。
先将源文件编译成目标文件:gcc - c hello.c
生成hello.o文件,再将目标文件编译成可执行文件:gcc -o hello hello.o
如:
int main(int argc,char **argv)
{
printf("Hello Linux ");
}

(9)c命令行编译器命令扩展阅读:
在使用GCC编译器的时候,我们必须给出一系列必要的调用参数和文件名称。GCC编译器的调用参数大约有100多个,这里只介绍其中最基本、最常用的参数。具体可参考GCC Manual。
GCC最基本的用法是∶gcc [options] [filenames]
其中options就是编译器所需要的参数,filenames给出相关的文件名称。
网络_gcc
