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
