---
title: "Eclipse下利用VC编译器编写C/C++程序"
author: "JonsenElizee"
date: "2009-12-31T10:14:00Z"
tags: []
slug: "eclipse-vc-c-c"
draft: false
lastmod: "2009-12-31T10:14:00Z"
id: 1014919
url: "https://zqs.iteye.com/blog/1014919"
---

**安装eclipse-cpp-galileo-win32.zip**

**以下是最新eclipse cpp 开发IDE**

[http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-cpp-galileo-SR1-win32.zip](http://www.eclipse.org/downloads/download.php?file=%2Ftechnology%2Fepp%2Fdownloads%2Frelease%2Fgalileo%2FSR1%2Feclipse-cpp-galileo-SR1-win32.zip)

**设置make程序**

![](http://p.blog.csdn.net/images/p_blog_csdn_net/JonsenElizee/EntryImages/20091231/snap0105.png)

**设置binary parser**

![](http://p.blog.csdn.net/images/p_blog_csdn_net/JonsenElizee/EntryImages/20091231/snap0106.png)

**新建一个C++工程**

**编写头文件**

![](http://p.blog.csdn.net/images/p_blog_csdn_net/JonsenElizee/EntryImages/20091231/snap0108.png)

**编写实现**

![](http://p.blog.csdn.net/images/p_blog_csdn_net/JonsenElizee/EntryImages/20091231/snap0109.png)

**改写Makefile 【注意CC和LN指向你安装的VC的路径】**

CC = cl.exe /EHsc /MT /c /I "C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\include" /I "C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\include" /I "C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\PlatformSDK\\Include"  
LN = link.exe /LIBPATH:"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\lib" /LIBPATH:"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\atlmfc\\lib" /LIBPATH:"C:\\Program Files\\Microsoft Visual Studio .NET 2003\\Vc7\\PlatformSDK\\Lib"  
main = main  
all: $(main).exe  
@cmd /c $(main)  
$(main).exe: $(main).obj  
$(LN) -out:$(main).exe $(main).obj  
$(main).obj: $(main).cpp  
$(CC) -Fo $(main).obj $(main).cpp

clean:  
del $(main).exe  
del \*.obj

**输出执行log如下**

![](http://p.blog.csdn.net/images/p_blog_csdn_net/JonsenElizee/EntryImages/20091231/snap0110.png)

**附上微软C编译器 CL的详细参数**

C/C++ COMPILER OPTIONS

-OPTIMIZATION-

/O1 minimize space /Op\[-] improve floating-pt consistency  
/O2 maximize speed /Os favor code space  
/Oa assume no aliasing /Ot favor code speed  
/Ob&lt;n&gt; inline expansion (default n=0) /Ow assume cross-function aliasing  
/Od disable optimizations (default) /Ox maximum opts. (/Ogityb2 /Gs)  
/Og enable global optimization /Oy\[-] enable frame pointer omission  
/Oi enable intrinsic functions

-CODE GENERATION-

/G3 optimize for 80386 /Gh enable \_penter function call  
/G4 optimize for 80486 /GH enable \_pexit function call  
/G5 optimize for Pentium /GR\[-] enable C++ RTTI  
/G6 optimize for PPro, P-II, P-III /GX\[-] enable C++ EH (same as /EHsc)  
/G7 optimize for Pentium 4 or Athlon /EHs enable C++ EH (no SEH exceptions)  
/GB optimize for blended model (default) /EHa enable C++ EH (w/ SEH exceptions)  
/Gd \_\_cdecl calling convention /EHc extern "C" defaults to nothrow  
/Gr \_\_fastcall calling convention /GT generate fiber-safe TLS accesses  
/Gz \_\_stdcall calling convention /Gm\[-] enable minimal rebuild  
/GA optimize for Windows Application /GL\[-] enable link-time code generation  
/Gf enable string pooling /QIfdiv\[-] enable Pentium FDIV fix  
/GF enable read-only string pooling /QI0f\[-] enable Pentium 0x0f fix  
/Gy separate functions for linker /QIfist\[-] use FIST instead of ftol()  
/GZ Enable stack checks (/RTCs) /RTC1 Enable fast checks (/RTCsu)  
/Ge force stack checking for all funcs /RTCc Convert to smaller type checks  
/Gs\[num] control stack checking calls /RTCs Stack Frame runtime checking  
/GS enable security checks /RTCu Uninitialized local usage checks  
/clr\[:noAssembly] compile for the common language runtime  
noAssembly - do not produce an assembly  
/arch:&lt;SSE|SSE2&gt; minimum CPU architecture requirements, one of:  
SSE - enable use of instructions available with SSE enabled CPUs  
SSE2 - enable use of instructions available with SSE2 enabled CPUs

-OUTPUT FILES-

/Fa\[file] name assembly listing file /Fo&lt;file&gt; name object file  
/FA\[sc] configure assembly listing /Fp&lt;file&gt; name precompiled header file  
/Fd\[file] name .PDB file /Fr\[file] name source browser file  
/Fe&lt;file&gt; name executable file /FR\[file] name extended .SBR file  
/Fm\[file] name map file

-PREPROCESSOR-

/AI&lt;dir&gt; add to assembly search path /Fx merge injected code to file  
/FU&lt;file&gt; forced using assembly/module /FI&lt;file&gt; name forced include file  
/C don't strip comments /U&lt;name&gt; remove predefined macro  
/D&lt;name&gt;{=|#}&lt;text&gt; define macro /u remove all predefined macros  
/E preprocess to stdout /I&lt;dir&gt; add to include search path  
/EP preprocess to stdout, no #line /X ignore "standard places"  
/P preprocess to file

-LANGUAGE-

/Zi enable debugging information /Ze enable extensions (default)  
/ZI enable Edit and Continue debug info /Zl omit default library name in .OBJ  
/Z7 enable old-style debug info /Zg generate function prototypes  
/Zd line number debugging info only /Zs syntax check only  
/Zp\[n] pack structs on n-byte boundary /vd{0|1} disable/enable vtordisp  
/Za disable extensions (implies /Op) /vm&lt;x&gt; type of pointers to members  
/Zc:arg1\[,arg2] C++ language conformance, where arguments can be:  
forScope - enforce Standard C++ for scoping rules  
wchar\_t - wchar\_t is the native type, not a typedef

-MISCELLANEOUS-

@&lt;file&gt; options response file /wo&lt;n&gt; issue warning n once  
/?, /help print this help message /w&lt;l&gt;&lt;n&gt; set warning level 1-4 for n  
/c compile only, no link /W&lt;n&gt; set warning level (default n=1)  
/H&lt;num&gt; max external name length /Wall enable all warnings  
/J default char type is unsigned /Wp64 enable 64 bit porting warnings  
/nologo suppress copyright message /WX treat warnings as errors  
/showIncludes show include file names /WL enable one line diagnostics  
/Tc&lt;source file&gt; compile file as .c /Yc\[file] create .PCH file  
/Tp&lt;source file&gt; compile file as .cpp /Yd put debug info in every .OBJ  
/TC compile all files as .c /Yl\[sym] inject .PCH ref for debug lib  
/TP compile all files as .cpp /Yu\[file] use .PCH file  
/V&lt;string&gt; set version string /YX\[file] automatic .PCH  
/w disable all warnings /Y- disable all PCH options  
/wd&lt;n&gt; disable warning n /Zm&lt;n&gt; max memory alloc (% of default)  
/we&lt;n&gt; treat warning n as an error

-LINKING-

/MD link with MSVCRT.LIB /MDd link with MSVCRTD.LIB debug lib  
/ML link with LIBC.LIB /MLd link with LIBCD.LIB debug lib  
/MT link with LIBCMT.LIB /MTd link with LIBCMTD.LIB debug lib  
/LD Create .DLL /F&lt;num&gt; set stack size  
/LDd Create .DLL debug library /link \[linker options and libraries]

**LINK详细参数**

Microsoft (R) Incremental Linker Version 7.10.3077  
Copyright (C) Microsoft Corporation. All rights reserved.

usage: LINK \[options] \[files] \[@commandfile]

options:

/ALIGN:#  
/ALLOWBIND\[:NO]  
/ASSEMBLYDEBUG\[:DISABLE]  
/ASSEMBLYLINKRESOURCE:filename  
/ASSEMBLYMODULE:filename  
/ASSEMBLYRESOURCE:filename  
/BASE:{address|@filename,key}  
/DEBUG  
/DEF:filename  
/DEFAULTLIB:library  
/DELAY:{NOBIND|UNLOAD}  
/DELAYLOAD:dll  
/DELAYSIGN\[:NO]  
/DLL  
/DRIVER\[:{UPONLY|WDM}]  
/ENTRY:symbol  
/EXETYPE:DYNAMIC  
/EXPORT:symbol  
/FIXED\[:NO]  
/FORCE\[:{MULTIPLE|UNRESOLVED}]  
/HEAP:reserve\[,commit]  
/IDLOUT:filename  
/IGNOREIDL  
/IMPLIB:filename  
/INCLUDE:symbol  
/INCREMENTAL\[:NO]  
/KEYFILE:filename  
/KEYCONTAINER:name  
/LARGEADDRESSAWARE\[:NO]  
/LIBPATH:dir  
/LTCG\[:{NOSTATUS|PGINSTRUMENT|PGOPTIMIZE|STATUS}]  
(PGINSTRUMENT and PGOPTIMIZE are only available for IA64)  
/MACHINE:{AM33|ARM|EBC|IA64|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|  
SH3|SH3DSP|SH4|SH5|THUMB|X86}  
/MAP\[:filename]  
/MAPINFO:{EXPORTS|LINES}  
/MERGE:from=to  
/MIDL:@commandfile  
/NOASSEMBLY  
/NODEFAULTLIB\[:library]  
/NOENTRY  
/NOLOGO  
/OPT:{ICF\[=iterations]|NOICF|NOREF|NOWIN98|REF|WIN98}  
/ORDER:@filename  
/OUT:filename  
/PDB:filename  
/PDBSTRIPPED:filename  
/PGD:filename  
/RELEASE  
/SAFESEH\[:NO]  
/SECTION:name,\[E]\[R]\[W]\[S]\[D]\[K]\[L]\[P]\[X]\[,ALIGN=#]  
/STACK:reserve\[,commit]  
/STUB:filename  
/SUBSYSTEM:{CONSOLE|EFI\_APPLICATION|EFI\_BOOT\_SERVICE\_DRIVER|  
EFI\_ROM|EFI\_RUNTIME\_DRIVER|NATIVE|POSIX|WINDOWS|  
WINDOWSCE}\[,#\[.##]]  
/SWAPRUN:{CD|NET}  
/TLBOUT:filename  
/TSAWARE\[:NO]  
/TLBID:#  
/VERBOSE\[:{LIB|SAFESEH}]  
/VERSION:#\[.#]  
/VXD  
/WINDOWSCE:{CONVERT|EMULATION}  
/WS:AGGRESSIVE