Getting started with C ++ development using eclipse CDT

Source: Internet
Author: User
Tags gdb debugger

Set up the eclipse cdt c ++ IDE development environment 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 into CT 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 initialize 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.

 

Additional tools required for configuring CDTFor 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 shoshould work fine. Wish you a happy coding with eclipse.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.