5,118,316 members and growing! (16,989 online)
Email Password   helpLost your password?
General Programming » Programming Tips » General     Intermediate

C++ Development using eclipse IDE– Starters guide

By Boby Thomas P

C++ Development using eclipse IDE– Starters guide
Windows, Visual Studio, Dev

Posted: 25 May 2006
Updated: 25 May 2006
Views: 87,622
Announcements



Search    
Advanced Search
Sitemap
20 votes for this Article.
Popularity: 5.71 Rating: 4.39 out of 5
0 votes, 0.0%
1
1 vote, 5.3%
2
1 vote, 5.3%
3
7 votes, 36.8%
4
10 votes, 52.6%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article
Title:       C++ Development using eclipse IDE– Starters guide.
Author:      Boby Thomas P
Email:       bobypt@gmail.com
Environment: Eclipse - Win / Linux
Keywords:    Eclipse, CDT
Level:       Intermediate
Description: This article will guide you to set up CDT plugin to eclipse for C++ development.
Section      C++
SubSection   General

C++ Development using eclipse IDE– Starters guide

Introduction

I was a fulltime user of windows operating systems and Microsoft visual studio products for c/c++ application development. Couple of month's back I started using Linux (Ubuntu breezy). I searched for a good IDE for C++ developments in Linux and found eclipse and its plug in architecture very powerful. I decided to start using Eclipse in Ubuntu and everything worked very well. Then I decided to use the same IDE for windows as well, which will make myself more comfortable with eclipse environment. But I faced few problems while setting up a C++ development environment with eclipse and so I decided to document the same so that others also can get benefit from what I have found out.

Setting up 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.

Sample image

You will get a dialog where you can specify the eclipse CDT plug in path for installation.

Sample image

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.

Sample image

  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-2006
INCLUDES = -I ./include
 
CC = g++ -g -Wno-deprecated
CFLAGS = -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.

Additional tools required for 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.

Sample image

  • Select "Project->Properties->C/C++ Make Project" and set proper debugger you have installed.

Sample image

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

Sample image

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

Sample image

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

Conclusion

Eclipse is free software available in Windows as well as Linux. C++ applications developed in eclipse can be easily taken to any other platforms very easily. Also as a developer, if you are familiar with eclipse development environment, switching from Windows to Linux is no big deal.

</body></html>

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Boby Thomas P


Check my homepage for more details - Click Here


Location: Germany Germany

Other popular Programming Tips articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 19 of 19 (Total in Forum: 19) (Refresh)FirstPrevNext
Subject  Author Date 
Questiona simple program on EMP [modified]membersireeshakolluri0:41 9 Apr '08  
GeneralError trying to debugmemberhallrd8:52 2 Oct '06  
AnswerRe: Error trying to debugmemberwoleadetiba15:38 19 May '07  
GeneralRe: Error trying to debugmemberjbperrin14:36 1 May '08  
QuestionHow-to get C++ online help from Eclipse CDTmemberphgddr5:26 28 Aug '06  
QuestionFailed to makememberMichael knafo0:57 21 Jul '06  
AnswerRe: Failed to makememberBoby Thomas P3:43 21 Jul '06  
GeneralStep-by-step debuggermembered welch9:46 5 Jun '06  
GeneralMFC support?membermr.scrag8:15 30 May '06  
GeneralEclipse Slow?memberRichardS23:23 29 May '06  
GeneralRe: Eclipse Slow?memberrpwt9:48 30 May '06  
GeneralRe: Eclipse Slow?memberralphatcp0:28 14 Mar '07  
GeneralRe: Eclipse Slow?memberRichardS0:34 14 Mar '07  
GeneralSounds like a useful toolmemberJun Du8:59 25 May '06  
GeneralRe: Sounds like a useful tool [modified]memberBoby Thomas P9:35 25 May '06  
GeneralRe: Sounds like a useful tool [modified]memberVertyg03:26 26 May '06  
GeneralRe: Sounds like a useful tool [modified]memberBoby Thomas P4:19 26 May '06  
GeneralRe: Sounds like a useful toolmemberJun Du5:33 26 May '06  
GeneralRe: Sounds like a useful tool [modified]memberBoby Thomas P5:35 26 May '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 25 May 2006
Editor:
Copyright 2006 by Boby Thomas P
Everything else Copyright © CodeProject, 1999-2008
Web17 | Advertise on the Code Project