`
JonsenElizee
  • 浏览: 44935 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Eclipse下利用VC编译器编写C/C++程序

阅读更多

安装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

设置make程序

设置binary parser

新建一个C++工程

编写头文件

编写实现

改写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如下

附上微软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<n> 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:<SSE|SSE2> 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<file> name object file
/FA[sc] configure assembly listing /Fp<file> name precompiled header file
/Fd[file] name .PDB file /Fr[file] name source browser file
/Fe<file> name executable file /FR[file] name extended .SBR file
/Fm[file] name map file

-PREPROCESSOR-

/AI<dir> add to assembly search path /Fx merge injected code to file
/FU<file> forced using assembly/module /FI<file> name forced include file
/C don't strip comments /U<name> remove predefined macro
/D<name>{=|#}<text> define macro /u remove all predefined macros
/E preprocess to stdout /I<dir> 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<x> 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-

@<file> options response file /wo<n> issue warning n once
/?, /help print this help message /w<l><n> set warning level 1-4 for n
/c compile only, no link /W<n> set warning level (default n=1)
/H<num> 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<source file> compile file as .c /Yc[file] create .PCH file
/Tp<source file> 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<string> set version string /YX[file] automatic .PCH
/w disable all warnings /Y- disable all PCH options
/wd<n> disable warning n /Zm<n> max memory alloc (% of default)
/we<n> 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<num> 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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics