利用Eclipse CDT進行C++開發的入門

來源:互聯網
上載者:User
 

設定Eclipse CDT C++ IDE開發環境 Steps
  1. Download and install latest java runtime environment. (You might be having one. If not install it). You can find it in www.eclipse.org.
  2. Download and extract eclipse to a suitable directory. You can find this also in eclipse website.
  3. Launch eclipse (It will launch without any problems if you have Java runtime environment installed) and add the CDT link in help -> Software updates -> find and install.

 


 

You will get a dialog where you can specify the eclipse CDT plug in path for installation.Now eclipse will connect to the Internet location specified and install the required components for eclipse CDT. You need to be connected to Internet for this installation. Please read the document in the eclipse CDT location for offline installation. http://www.eclipse.org/cdt/

 

  1. Now Launch File -> New -> Project and you will get a dialog like this where you can specify C++ project and continue with remaining stuffs.

 

  1. Looks very easy right. Create a new project as usual write a hello world program. And compile it. It wont compile because eclipse expect you to supply the make file required for compilation. Write a simple make file as given below and keep it in the same directory where your c++ source files are kept.

 

#Make file written by boby Thomas Pazheparampil#21-5-2006INCLUDES = -I ./include CC = g++ -g -Wno-deprecatedCFLAGS = -c $(INCLUDES)all : cmain cmain : cmain.o            $(CC) cmain.o -o cmain cmain.o : cmain.cpp            $(CC) $(CFLAGS) cmain.cpp  clean :            rm -f *.o
  1. Now compile again, you will get a message like this "error launching external scanner info generator /GCC -E -P -v -dD eclipse CDT". The reason for this error is, the GCC compiler required for compiling the source files are not present in the windows path location. You confirm this by typing "gcc --version" in command prompt. If you get a message saying command not found, you can be sure that GCC compiler is not available.

 

配置CDT需要的附加工具For running CDT from eclipse, you need to have the following tools.
  • Make tools for make process.
  • GNU compiler collection (GCC) for compilations.
  • GDB for debugging.
You can download all these tools from www.MinGW.org. You have to download and install build tools (make), compiler (GCC) and debugger (GDB). You can find all these tools in the location www.cygwin.com also. But I recommend the usage of mingw.

 

Once you have all the supporting tools available, change few settings in eclipse.

 

  • Select "Project->Properties->C/C++ Make Project->Binary Parser" and select Elf Parser and PE windows parser.
  • Select "Project->Properties->C/C++ Make Project" and set proper debugger you have installed.

 

 

  • Select "Run->Debug->Debugger" and select "GDB debugger" and locate the path to gdb debugger.

 

 

  • Select "Run->Create Make Target" and set a proper make command you need to execute for different make operations.

 

 

Now try debugging again. It should work fine. Wish you a happy coding with eclipse.
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.