📄 node10.htm
字号:
<HTML>
<HEAD>
<!-- This file was generated by tohtml from mpichntman.tex -->
<!-- with the command
tohtml -default -dosnl -gaudy -basedef mpiman.def mpichntman.tex
-->
<TITLE>Compiling with VC++ from the command line</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<HR><H2><A NAME="Node10">Compiling with VC++ from the command line</a></H2>
<A HREF="node9.htm#Node9"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node8.htm#Node8"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node11.htm#Node11"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node8.htm#Node8"> Programming Tips</a>
<b>Next: </b><A HREF="node11.htm#Node11"> Compiling and linking with Fortran</a>
<b>Previous: </b><A HREF="node9.htm#Node9"> Compiling and linking with Microsoft Developer Studio (VC++ 6.x)</a>
<P>
If you want to compile from the command line instead of using the MS Integrated
Development Environment, here are the compile and link commands copied from the cpi
project in the examples directory.
<ol>
1. Bring up a command prompt.
<BR>
2. Execute <em>vcvars32.bat</em> to set up the environment variables for VC++.
<BR>
3. compile <em>example.c</em>:
<P>
Debug target: execute this:
<P>
<tt> cl.exe /nologo /MTd /W3 /GX /Od /I
"C:<IMG WIDTH=5 HEIGHT=11 SRC="img26.xbm">
Program Files<IMG WIDTH=5 HEIGHT=11 SRC="img27.xbm">
MPICH<IMG WIDTH=5 HEIGHT=11 SRC="img28.xbm">
SDK<IMG WIDTH=5 HEIGHT=11 SRC="img29.xbm">
include"
/D WIN32 /D _DEBUG /D _CONSOLE /D _MBCS /GZ /c example.c</tt>
<P>
Release target: execute this:
<P>
<tt> cl.exe /nologo /MT /W3 /GX /O2 /I
"C:<IMG WIDTH=5 HEIGHT=11 SRC="img30.xbm">
Program Files<IMG WIDTH=5 HEIGHT=11 SRC="img31.xbm">
MPICH<IMG WIDTH=5 HEIGHT=11 SRC="img32.xbm">
SDK<IMG WIDTH=5 HEIGHT=11 SRC="img33.xbm">
include"
/D WIN32 /D NDEBUG /D _CONSOLE /D _MBCS /c example.c</tt>
<P>
<BR>
4. link <em>example.obj</em>:
<P>
Debug target: execute this:
<BR>
<pre><tt>link.exe ws2_32.lib mpichd.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib
/nologo /subsystem:console /debug /machine:I386 /out:"example.exe"
/pdbtype:sept
/libpath:"C:\Program Files\MPICH\SDK\lib"
example.obj
</tt></pre>
Release target: execute this:
<P>
<BR>
<pre><tt>link.exe ws2_32.lib mpich.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
odbc32.lib odbccp32.lib
/nologo /subsystem:console /machine:I386 /out:"example.exe"
/libpath:"C:\Program Files\MPICH\SDK\lib"
example.obj
</tt></pre>
Depending on what functions <em>example.c</em> uses, you may not need all the libraries
specified above.
<P>
</ol>
<P>
<HR>
<A HREF="node9.htm#Node9"><IMG WIDTH=16 HEIGHT=16 SRC="previous.xbm"></A><A HREF="node8.htm#Node8"><IMG WIDTH=16 HEIGHT=16 SRC="up.xbm"></A><A HREF="node11.htm#Node11"><IMG WIDTH=16 HEIGHT=16 SRC="next.xbm"></A><BR>
<b>Up: </b><A HREF="node8.htm#Node8"> Programming Tips</a>
<b>Next: </b><A HREF="node11.htm#Node11"> Compiling and linking with Fortran</a>
<b>Previous: </b><A HREF="node9.htm#Node9"> Compiling and linking with Microsoft Developer Studio (VC++ 6.x)</a>
<P>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -