[转]Use Intel C++ Compiler in Eclipse (CDT) under Win32

邵璞
2023-12-01

许久了,都想逃离微软的开发平台,最初还是在gcc这样的编译平台上,说实在话,还是intel的编译平台优化效果好。无意间看到了这边文章,特做保留。我不是一个java的支持者,但是一个纯粹的C++崇拜者。

 

官方最权威资料 http://www.intel.com/software/products/compilers/clin/docs/Getting_Started.htm

 

转自 http://www.javanb.com/eclipse/1/4758.html

 

Introduction
Eclipse provides a very good C++ IDE, called CDT. Under Windows(2K,xp), if you want to compiler C++ programs using CDT, some configurations must be done unless you installed Cygwin or MingGW.
Here are some tips to use Intel C++ compiler in Eclipse (CDT).

What you need?
Intel C++ Compiler (I use version 8.1)
Microsoft Visual Studio or Visual Studio .Net (I use .Net 2003)

Follow these steps:

1. Install Intel C++ Compiler.

2. Modify User Environment Variable INLCUDE as, depending on your specific path
INCLUDE = C:/Program Files/Intel/CPP/Compiler80/Ia32/Include;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/ATLMFC/INCLUDE;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/INCLUDE;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/PlatformSDK/include/prerelease;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/PlatformSDK/include;C:/Program Files/Microsoft Visual Studio .NET 2003/SDK/v1.1/include;C:/Program Files/Microsoft Visual Studio .NET 2003/SDK/v1.1/include/

3. Modify User Environment Variable LIB as, depending on your specific path
LIB=C:/Program Files/Intel/CPP/Compiler80/Ia32/Lib;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/ATLMFC/LIB;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/LIB;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/PlatformSDK/lib/prerelease;C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/PlatformSDK/lib;C:/Program Files/Microsoft Visual Studio .NET 2003/SDK/v1.1/lib;C:/Program Files/Microsoft Visual Studio .NET 2003/SDK/v1.1/Lib

4. Open Eclipse(CDT), New->Standard Make C++ Project, name it say "test1".

5. Add a source file into the project, say "test1.cpp".

6. Add a file named "makefile", with content as the following:

all: test1.exe

test1.exe: test1.obj
icl test1.obj
test1.obj: test1.cpp
icl test1.cpp

clean:
del *.obj
del *.exe

7. Open Project -> Properties -> C/C++ make Project -> make Builder
Build Command -> disable "use default"
-> Fill in Build Command: nmake -f makefile CPP=icl.exe LINK32=xilink.exe

8. Now you can build your C++ project using Intel C++ Compiler.

Note:

1. Because I can not set LIB and INCLUDE Environment Variables in the makefile, I did it once in System/User
Environment Variables (My Computer->Properties->Advanced->Environment Variables->User Variables for xxx). You may set those in the makefiles if you can to save space for systems.

2. all and clean targets are needed by Eclipse. Of course you can set these targets to something else in Project->Properties->C/C++ Make Project->Make Builder.

3. Library issue: the Intel C++ Compiler provides libm.lib and libirc.lib. Microsoft provides libc.lib and oldnames.lib. Additional libraries must be provided if your programm needs them. Most of these libs are provided in Visual Studio (.Net),
that's why it needs installed on your computer.

If you want to link your program with alternate or additional libraries, neither Intel C++ Compiler nor Visual Studio (.Net) provides, specify them at the end of the command line. For example, to compile and link hello.c with mylib.lib, use the following command in makefile :

icl /Fehello.exe hello.cpp mylib.lib

4. Why use Eclipse for C++ Programming?
Simply because Eclipse+CDT is better. Of course that's just the personal favor.

 类似资料: