Programming resources for C++ in Linux - c++

I am new (in a way) to C++ programming. I would like to start doing development in Linux using C and/or C++ as programming languages. I have done some development for a while in Java.
Unfortunately I am not sure where to start. Can you point me to some good resources, and also give me an outline as to what would be the primary difference between C and C++ in Windows and Linux?
Any special steps I need to do to get started? Also any good IDEs. I plan to use Eclipse currently. I am using Kubuntu (version 9.x).

IDEs:
QtCreator: http://qt.nokia.com/products/appdev/developer-tools/developer-tools
Kdevelop: http://www.kdevelop.org/
Books:
Thinking in C++ / Bruce Eckel http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html
Brose standard libraries:
http://www.cplusplus.com/reference/iostream/

It is good that you are using a Linux platform as it will help you to program as per the C and C++ standards.
I would recommend
vi/vim --> text editor
gcc --> C compiler
g++ --> C++ compiler
gdb --> Command line debugger
ddd --> GUI debugger
I use the above mentioned tools. If you are hell-bent on IDEs, you can use the ones mentioned by Chen Levy

If you have done development in Java, then you can start with any tutorial on the internet. There are literally hundreds of them!
I don't expect it to be hard since you have a Java background.
Here is a nice tutorial on CPlusPlus.com.
Also, check out this question on StackOverflow: The definitive C book guide and list.

IDE
Eclipse is very good as a starting point.
The new CDT provides a completely set up environment.
Just be sure to install gcc and gdb before
trying out anything.
And don't use the eclipse in the ubuntu repos, download a
current release.
Difference Windows/Linux:
The language standard is completely the same in both worlds. (Compiler implementations vary in fullfillment of the standard, but you shouldn't notice anything in the beginning.)
If you stick to cross-platform tools, compiler(gcc/mingw), ide and debugger it can stay this way. (I imply that the obvious differences, like .so s and .dlls and stuff are known)
If you move over to other compilers and library implementations (MSVisualC++ for instance) it can get interesting in the advanced stages, but it shouldn't be too difficult to bridge the gaps.
Good/essential libs to know:
the stl, boost, and maybe for productivity and ease in the beginning: qt.
These are as platform independent and generally useful as possible. Know them, and they are usable through your complete c++ lifetime.
(Don't make the mistake to want to learn it all in one go, just go step by step.
Don't try template programming in the beginning, it is mind-boggling ;) but using
templates is fun)

IDE / Editor I think with Eclipse you can quite good start with. I perfer emacs and use of the command line tools of gcc. Why? I think you learn more of the basics how they work.
Good libs: STL, QT, boost with these tree you have the ability to create/develop most of the parts you like or you need.
In my opinion very important is that you stuck (in the beginning) to the libray you selected. And also to the IDE/editor.
Starting point: As earlier mentioned Thinking in C++, Second edition (Volume 1 &2) by Bruce Eckel. He trys to explain the difference between C and C++. In volume 1 he explains the basics of C++ and in volume 2 he introduces some parts of the STL.
Another usefull ressource for me was C++ FAQ lite Here you can find a lot of usefull tipps.

If you will ever want some library good places to start are sourceforge.net and freshmeat.net

Related

C++ Programming tools

My teacher recommended us to use notepad++ and cygwin for our programming needs. Are there any better solutions anyone can recommend out there to program and compile?
Myriad of various IDE's.... Eclipse CDT, Visual Studio Express, Code::Blocks, DevCPP....
And yes, Notepad++ and Cygwin with gcc would be a very viable option if you only need to compile single files for your homework.
Use a IDE
An integrated development environment (IDE) (also known as integrated design environment, integrated debugging environment or interactive development environment) is a software application that provides comprehensive facilities to computer programmers for software development. An IDE normally consists of:
a source code editor
a compiler and/or an interpreter
build automation tools
a debugger
A few of them to choose from
http://netbeans.org/index.html
http://www.codeblocks.org/
http://www.eclipse.org/cdt/
In my opinion, a very important tool for beginners is a debugger. A lot of question can be answered by yourself if you have a look into the debugger. You can use the gdb but it is hard to use and understand for beginners. So I would recommend to use Visual C++ 2010 Express which has an excellent and easy to use debugger.
Disclaimer:
The following are personal opinions, related to my personal taste on
the subject. Anyone in the programmer community has its own taste and
preferences an can agree or not. Here I just want to tell you about
some rationals. Consider products and related names as "examples."
My Answer
There are mainly three ways to write code:
The manual one
The assisted one
The automated one.
Think to them as:
Driving your car alone
Driving with a navigator
Driving with an autopilot.
Here "driving alone" means "use a generic text editor, a command-line based compiler and a command-line based debugger. The editor may eventually have a clue about the language syntax (thus differentiating different language structural elements, like keyword, literals, operators etc.) but knowing really nothing about what you are coding.
This is what notepad++ does. It makes coding harder, but for very simple things makes you really learn how to "drive".
A "navigator" is a basic IDE like Devc++, or like CodeBlocks: they have the notion of "project", manage the relation between files and manage the invocation of the compiler and debugger, managing the mapping on their output respect to your sources.
You write your own code, but the "road to compile" is told by the "navigator" you have to trust.
An "autopilot" is a more complex IDE (like VisualStudio, Netbeans, Eclipse ...) that can also "manage the code" providing code analysis for either syntax and semantics, context sensitive auto-completion, code generation for common tasks.
They can give you some code you have to complete and connect together.
They make you faster in producing code, testing it, debugging it, but you must have more trust in them or know how they "suggest".
They can be productive, but you have to "configure" them to suite your needs.
Now: since everything is a matter of "trust", and you cannot trust what you don't know yet, and is a matter of "knowing yuur needs" (but a learner may not yet have an idea abut them)
starting with "beasts" like VisualStudio (that mess arout 50% of your computer registry, pretend you to download GIGABYTES from the Internet and installs GIGABYTES of whatever MS library) is clueless: before you will start using all of that, will take years, and VS itself will be changed 2 or three times) or Eclipse (that has the more powerful syntax and semantic analizer, but requires lot of "arcane configuration" you don't even know since you didn't make the first step in programming) may be an excess. At least until your programs will stay in a couple of pages.
starting win notepad++ and GCC (or Mingw) is just a matter of dowload few megabytes, set a PATH, and you go. Fastest way to turn the key on.
when things become more complex, and require some help in organize them, simple IDE like CodeBloks or Codelite are more than effective at "to the point". I will avoid Dev-C++: it's OLD, and doesn't support the "state of art of the C++ language". You an live with them for all your scolarity
when going to more professional kind of projects, and your experience in "using tools" is better, things like Eclipse, or NetBeans may become more "effective". I will in any case avoid VisualStudio: it's not that "effective". But it is the best to develop in Microsoft environments producing MS oriented applications, especially in the ".Net" world. Something you will not see before 2/3 years of experience.
If you're learning you can download VStudio Express. I believe it's free. Easier to use than notepad and cygwin. This isn't a biased opinion. I'm a Linux C++ developer most days but acknowledge the fact that it might be easier to learn using VStudio.
If you are using linux, you can use kate and g++ for editing and compiling c++ files.
If you are using windows, I think your teacher's recommendations are good. Althought there are various IDE's for C++, it is better to use a simple editor that doesn't have code completion and compilation feature while learning a programming language for the first time. IDE's are nice but not good for learners I think.
It's probably a good idea to go with your teacher's suggestion, since you might also need some help in the future, either from him or your colleagues. Another advantage is that, being in school, you'll probably develop using more than one programming language. Notepad++ has support for almost everything you can think of, so you can use it not only for this course. That way you'll have an advantage because you'll learn shortcuts, etc...
If you plan on doing a lot of programming in the future, I highly recommend putting the effort into learning VIM. Nothing else can touch it in terms of speed and power. It has built-in shell access and it is programmable. It is like having God in your text editor. The major down-side is the steep learning curve.
Also, you want to use Git in-case you screw-up and want to go back to a previous point. It lets you periodically check-point your code so you can always go back. For example, maybe you delete something, then later on decide you want to use that code after all. If you've been check-pointing with Git, you can get it back.
Graphical differs sometimes come in handy too.
I started coding in C++ using Turbo C++(the default program available on college computers, I told them it was prehistoric), but then I found Visual Studio Express and never looked back since that day.
Also since i could not install Visual Studio on College computers, I put a portable version of DevC++ on my pen drive to use there.
Eventually I got the College to install Visual Studio Express editions on all Lab Computers (Once I managed to convince them that it was free with no Licensing issues)
For a beginner, go with a text editor and a compiler. Helps you in understanding what actually goes on.
You could use Dev-C++, which is a good compiler for C and C++, if you want lightweight.
Otherwise Visual Studio probably.

Can i code C++ for non-os x based frameworks and such on Xcode?

I have just begun learning C++ through a flemmish government funded course. I was given 'thinking in c++' by Bruce Eckel as my educative material.
Besides learning c++ i'm also picking up objective-c on my own as I go, my long-tearm goal is to be a independent osx/ios dev, but i have to learn an succeed in c++ for the funding to continue. Betting on two horses and such.. you're getting the picture, i'm sure.
So now it begins. I have to choose an IDE. Xcode seems only to serve the os x oriented C++ development as far as I understand... Am i right?
I would consider other IDE's like eclipse or even go linux and what not, but in the end, long term, I'm going to be coding in Xcode because of my independent ambitions... So it would be really convenient if I could get started with Xcode right away, nice and comfy, so i don't have to divide my 'learning curve' an lose valuable time
So the question nice and short; is it possible to code C++ for non-osx based sources and frameworks and what not. More importantly, can i learn everything in the book by Eckel if i stick to Xcode?
I'm a new kid on the block. Forgive stupid questions and wrong usage of dev lingo.
much obliged.
Yes - stick with Xcode - you don't need to use any Apple-specific frameworks - just build command line tools.
Sure you can. Most good programming language books don't talk much in terms of any particular editor or IDE. And OS X is at least somewhat amenable to using open source software libraries that you might want over time (e.g. Boost).
If have not used Xcode but I don't see why you should not be able to do so. If you want to build for non mac machines you just have to compile your code with the proper flags, and be mindful of the libraries available on the other system. As for frameworks, you won't find them on non mac machines so you shouldn't use -framework option in gcc.

Learning C++ without an IDE

I've recently started to learn C++ and am completely confused with the choices of IDEs and compilers out there. I am competent with interpreted languages and like the simplicity of using any IDE or text editor and then running the interpreter from the command line. Everything works as I expect, regardless of the IDE used, because I use the same interpreter each time.
Now that I have started learning C++ I am overwhelmed by the choice of different compilers and more importantly, their differences. It seems that things will be simpler for me (not necessarily easier) if, while learning, I use a text editor and a compiler that I run from the command line. I have a basic understanding of how compiling and linking works and I understand the role of header files.
Firstly, are there any books or websites that teach C++ from this approach? (IDE-less)
Many books try to point out the differences between IDEs and compilers by selecting two and comparing them, which confuses me.
Secondly, how should I set up my workflow? (Ignore the choice of text editor, I am talking about compilers, linkers etc.) I am struggling to understand what differences different compilers have and so please bear this in mind when answering. It seems like the most popular compilers are g++ and CL.
Similar question but I am more interested in why some programs will work with some compilers and not others: C++ Compiler for Windows without IDE?
Further information: I am developing on Windows and from what I understand, it seems that there is 'pure' C++ and then C++ that is somehow related to windows, is this Visual C++? I would like to write programs that make use of Windows features but I want to know when I am using windows features and when I am writting code that would work on any platform.
Update: So it seems that I shouldn't be worrying about compilers when I am just starting out. The reason for me wanting to understand the differences is because I don't want to write code for a specific compiler and get into bad habits. Is this a non-issue?
Firstly, are there any books or websites that teach C++ from this approach? (IDE-less)
Yes, definitely. Stroustrup's book has already been mentioned. For learning C++ I'd also recommend two other books: If you like thorough explanations and don't shy away from 1000 pages, look at Lippman et al. If you rather like a short introduction and don't fear a steep learning curve, look at Koenig/Moo. Both are excellent books. (BTW, a good place to look for good books has always been the book review section at the ACCU.)
As for which tool chain you want to use: If you rather have a standalone editor and invoke the compiler from the command line, you can do this with either GCC or VC. This approach has the advantage that it is more unlikely to lure you into using something proprietary (like C++/CLI). If you would like to try an IDE, VC Express is fine, once you're past setting up a new C++ project. Of course, the number of options you can tweak for a new project can be very overwhelming. But on the other hand you get things like an integrated debugger. Note that there are other integrated solutions, too. The most mature and prominent is probably eclipse.
Edit: If you don't mind spending a little money, look at Comeau. It's not free, but it's not expensive either and it's usually considered to be the most standard-conforming C++ compiler around and has excellent error messages. (You can test-drive it at the website.) Note that it emits C code, though. That means you have to have another compiler to create an executable program. But both GCC and VC Express will do, so there's no other cost. (Note that using VC you will get Dinkumware's std lib implementation, which is also considered to be a very good one.)
Use MinGW - it's a command-line C++ development toolchain that allows you create Windows applications. The SO link you quoted seems to have all the relevant details, so I don't really understand why you posted this question.
Firstly, are there any books or websites that teach C++ from this approach? (IDE-less)
Start from reading The C++ Programming Language book. Written by Bjarne Stroustrup, the creator of C++, this is the world's most trusted and widely read book on C++.
Take a look also at Programming — Principles and Practice Using C++. It is an introduction to programming for people who has never programmed before. It will also be useful for people who have programmed a bit and want to improve their style and technique - or simply learn modern C++.
I am developing on Windows and from
what I understand, it seems that there
is 'pure' C++ and then C++ that is
somehow related to windows, is this
Visual C++? I would like to write
programs that make use of Windows
features but I want to know when I am
using windows features and when I am
writting code that would work on any
platform.
MS Visual C++ 2008 Express is a free IDE aimed at folks like you, it's available by download from Microsoft, I recommend you try it out.
Visual C++ is the name of the IDE program package. Installing it installs many things including the compiler cl.exe, which can compile, depending on settings, program written in either the C, C++, or C++/CLI programming language (for the .Net framework).
You can use the compiler on the command prompt without the IDE by (for example) selecting Start > Programs > Microsoft Visual Studio X > Visual Studio Tools > Visual Studio X Command Prompt. This execute a script which sets various environment settings needed to compile programs before giving you the command prompt.
On Windows I'd recommend you Visual Studio Express - it's free and is widely accepted by C++ programmers on Windows platform.
Since you're starting to learn language, don't bother yourself with differences, advantages/disadvantages of compilers and IDEs - leave it when you'll be more proficient with the language and will be involved in writing real program.
I actually suggest IDE approach, Microsoft Visual C++ Express Edition should do the trick. Excluding some fancy syntax most C++ compilers behave the same way. C++ is a language that has a very small standard library (covering mostly I/O functions, basic math etc..) this is probably what you refer as pure C++. For something more advanced you'll have to use system libraries.. In example if you want to write windows gui application you'll have to include windows.h header file which is platform specific and exists only on windows compilers..
If you won't use an IDE, you definitely want to use Makefiles to organize your workflow... and you can make easily from emacs or vim.
Anyway, may I suggest you to use a very simple, almost non intrusive IDE, that could be great for learning purposes: http://www.bloodshed.net/devcpp.html
It comes with the MinGW compiler bundled, so it's just install and go.
I'd say to start out with Visual Studio. This is a great IDE for programming C++ on windows, might as well use it when it can speed up certain things a lot.
The differences between compilers aren't that huge - if you can write solid code in VS then it shouldn't be a problem to figure out how to get your code working in GCC/G++.
As for books; Exceptional C++ by Herb Sutter and The C++ Programming Language by Bjarne Stroustrup are a great read.
Visual Studio is the way to go when developing for Windows.

How to revive C++ skills

I was a C++ developer (mostly ATL/COM stuff) until, as many of us, I switched to C# in 2001. I didn't do much C++ programming since then.
Do you have any tips on how to revive my C++ skills? What has changed in C++ in the last years? Are there good books, articles or blogs covering the language. The problem is that most material I could find either targets people who are new to the language or those with a lot of experience.
Which C++ libraries are popular these days? I guess I will need to read on the STL because I didn't use it much. What else? Boost? ATL? WTL?
Boost - though it, and other libraries were around back then, its only relatively recently that it's taken off in a big way. Google for TR1 and c++0x standards too. You should defintely read up on STL because (IMHO) its the thing that makes C++ special.
ATL is as good a dead technology (don't get me wrong, I liked it and still use it somewhat, but its not fashionable in the MS world anymore).
Something like QT is probably more new and cool for C++ developers, and has the advantage of getting you into all the new Linux and web development that'll be increasingly popular over the next few years.
However, once you start looking at the things you can do, I think it'll all come back quite quickly.
I personally find that syntax is where i mostly need to catch up when i wander back to a language i havent used in a long time. But the concepts and what the language is about stays the same in memory.
Assuming its the same with you, i would say its a good idea to relook at the texts you remember to have been useful to you while learning C++. I would recommned Thinking in C++ for getting up fast on the syntax.
STL would be really useful yes. Thats one thing i have found commonly appreciated by all mature C++ programmers. It would be useful to know the libraries that Boost provides.
The changes to C++ world, depends on the changes your favourite compiler has decided to implement. Since you mentioned ATl/COM i assume it would be VC++. The changes to MFC would be support for Windows Forms (2005 vc++) and Vista compliant uI's and ribbon support(?) (2008 Vc++)
VC++ now supports managed C++ -i'm sure you know what that is coming from the C# world - 2008 adds supports for managed STL too.
VC++ is trying to be more standards compliant and are making some progress in that area.
They have introduced lots of secure functions that depreciate the old stds like strcpy and the compilers will also give warnings if you use the old fns.
VC++2005 also has something called function attributes, which it uses to describe the parameters so that it can do more checking on the inputs you pass in and statically flag a warning if it sees soething amiss. Usefuli would say though our shop has not progressed to using the 2005 compiler.
MSDN has the list of breaking changes for each releases. Oh & Support for Windows 95, Windows 98, Windows Millennium Edition, and Windows NT 4.0 has been removed from 2005 version of VC++. Additionally the core libraries you required till now (CRT, ATL, MFC etc) now support a new deployment model which makes them shared side sy side assemblies and requires a manifest.
This link should get you going - http://msdn.microsoft.com/en-us/library/y8bt6w34.aspx
2008 adds even more like Tr1 recommendations, more optimizning compiler, parallel compilation(/mp), support for new processor architectures etc. Open Mp support has also been enhanced in one of these versions is what i remember.
Again refer MSDN - thats the suthentic source for all the answers.
Good luck.
Definitely read the latest edition of "Effective C++" by Scott Meyers. I would also recommend "C++ Gotchas: Avoiding Common Problems in Coding and Design" by Stephen C. Dewhurst.
To sharpen your C++ skills I'd suggest going over some of your old C++ code if you still have access to it. Revisiting it will hopefully trigger those parts of your brain that have laid dormant after switching to C# :)
For libraries STL is good, then boost. I don't think there is too much new stuff going on with ATL/WTL from what you would have known back in 2001.
Just start a project. The libraries you use will depend on your project, but you should certainly read up on the STL. If you haven't used C++ for a long time you might need learn more about templates.
Pickup one of the C++ Unit Test frameworks out there (I suggest Google C++ Testing Framework, aka. gtest). Pick a small project that you can start from scratch and try some TDD. The TDD will encourage you to make small steps and to reflect on your code. Also, as you build your suite of unit tests, it gives you a base from which you can experiment with different techniques.
Rewrite some of your C# stuff using C++
For a start, I'd say try writing code that will work on both a Mac and Windows or Linux and Windows. This will force you to write code that is much more portable than the type of C++ code you can get away with on Visual C++ - there a lot of finer points that are very different when you go cross platform.
I'd suggest stay away from libraries for now if you can - perfect your ANSI C++ game first. I'd also suggest reading up on C++0x - the next standard is due soon and it would help you more to work towards that. To that end, brush up on the STL (the concepts behind it, not the implementation so much) and templates.
If you'd like to try BOOST, go ahead, but you can generally get by without using it. The reason I stayed away from it mostly is because of the way templates are used to do what is needed - a lot of which will become much easier once the new standard is introduced.
UPDATE: Once you're comfortable with the STL and start needing to do things that require a lot of code with the STL or are just plain tricky, then head over to BOOST. Buy a book on BOOST and read it and understand it well.
Take some old piece of code and add to it. This won't get you back on top of the latest C++ trends but it will get your feet wet.
At my job I had to add some features to a C++ ActiveX control and I hadn't touched C++ in years and years and have never done it professionally. Figuring out how to do it again was actually pretty damn cool.
I was in a similar situation: switched from C++ to C# in 2005 and then switched back to C++ in 2007. I can't say C++ universe really changed in those 2 years. The most crucial thing was to regain my memory-management instincts, but that can only be done by practicing.
Now that you have both C++ and .NET under your belt you might want to study C++ CLI a bit (new incarnation of late "Managed C++").
As for books, read everything with "Meyers" and "Sutter" on the cover.

C++ IDE for Linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I want to expand my programming horizons to Linux. A good, dependable basic toolset is important, and what is more basic than an IDE?
I could find these SO topics:
Lightweight IDE for linux and
What tools do you use to develop
C++ applications on Linux?
I'm not looking for a lightweight IDE. If an IDE is worth the money, then I will pay for it, so it need not be free.
My question, then:
What good, C++ programming IDE is available for Linux?
The minimums are fairly standard: syntax highlighting, code completion (like intellisense or its Eclipse counterpart) and integrated debugging (e.g., basic
breakpoints).
I have searched for it myself, but there are so many that it is almost impossible to separate the good from the bads by hand, especially for someone like me who has little C++ coding experience in Linux. I know that Eclipse supports C++, and I really like that IDE for Java, but is it any good for C++ and is there something better?
The second post actually has some good suggestions, but what I am missing is what exactly makes the sugested IDE so good for the user, what are its (dis)advantages?
Maybe my question should therefore be:
What IDE do you propose (given your experiences), and why?
Initially: confusion
When originally writing this answer, I had recently made the switch from Visual Studio (with years of experience) to Linux and the first thing I did was try to find a reasonable IDE. At the time this was impossible: no good IDE existed.
Epiphany: UNIX is an IDE. All of it.1
And then I realised that the IDE in Linux is the command line with its tools:
First you set up your shell
Bash, in my case, but many people prefer
fish or
(Oh My) Zsh;
and your editor; pick your poison — both are state of the art:
Neovim2 or
Emacs.
Depending on your needs, you will then have to install and configure several plugins to make the editor work nicely (that’s the one annoying part). For example, most programmers on Vim will benefit from the YouCompleteMe plugin for smart autocompletion.
Once that’s done, the shell is your command interface to interact with the various tools — Debuggers (gdb), Profilers (gprof, valgrind), etc. You set up your project/build environment using Make, CMake, SnakeMake or any of the various alternatives. And you manage your code with a version control system (most people use Git). You also use tmux (previously also screen) to multiplex (= think multiple windows/tabs/panels) and persist your terminal session.
The point is that, thanks to the shell and a few tool writing conventions, these all integrate with each other. And that way the Linux shell is a truly integrated development environment, completely on par with other modern IDEs. (This doesn’t mean that individual IDEs don’t have features that the command line may be lacking, but the inverse is also true.)
To each their own
I cannot overstate how well the above workflow functions once you’ve gotten into the habit. But some people simply prefer graphical editors, and in the years since this answer was originally written, Linux has gained a suite of excellent graphical IDEs for several different programming languages (but not, as far as I’m aware, for C++). Do give them a try even if — like me — you end up not using them. Here’s just a small and biased selection:
For Python development, there’s PyCharm
For R, there’s RStudio
For JavaScript and TypeScript, there’s Visual Studio Code (which is also a good all-round editor)
And finally, many people love the Sublime Text editor for general code editing.
Keep in mind that this list is far from complete.
1 I stole that title from dsm’s comment.
2 I used to refer to Vim here. And while plain Vim is still more than capable, Neovim is a promising restart, and it’s modernised a few old warts.
My personal favorite is the CodeLite 2.x IDE.
see: http://www.codelite.org
The decision to use CodeLite was based on a research regarding the following C++ IDE for Linux:
Eclipse Galileo with CDT Plugin
NetBeans 6.7 (which is also the base for the SunStudio IDE)
KDevelop4
CodeBlocks 8.02
CodeLite 2.x
After all I have decided to use CodeLite 2.x.
Below I have listed some Pros and Cons regarding the mentioned C++ IDEs. Please note, that this reflects my personal opinion only!
EDIT: what a pity that SOF doesn't support tables, so I have to write in paragraphs ...
Eclipse Galileo with CDT Plugin
Pros:
reasonable fast
also supports Java, Perl(with E.P.I.C plugin)
commonly used and well maintained
also available for other OS flavours (Windows, MacOS, Solaris, AIX(?))
Cons:
GUI is very confusing and somewhat inconsistent - not very intuitive at all
heavy weight
Only supports CVS (AFAIK)
NetBeans 6.7 (note this is also the base for the SunStudio IDE)
Pros:
one of the most intuitive GUI I have ever seen
also supports Java, Python, Ruby
integrates CVS, SVN, Mercurial
commonly used and well maintained
also available for other OS flavours (Windows, MacOS, Solaris)
Cons:
extremly slow
heavy weight
uses Spaces for indentation, which is not the policy at my work. I'm sure this is configurable, but I couldn't find out how to to that
KDevelop4 (note: I did not much testing on it)
Pros:
commonly used on Linux
integrates CVS, SVN, Mercurial
Cons:
the GUI looks somewhat old fashioned
heavy weight
very specific to the KDE environment
CodeBlocks 8.02 (note: I did not much testing on it)
Pros:
reasonable fast
Cons:
the GUI looks somewhat old fashioned (although it has a nice startup screen)
the fonts in the editor are very small
some icons (e.g. the debugger related icons starting/stepping) are very small
no source control integration
CodeLite 2.x (note: this is my personal favorite)
Pros:
the best, modern looking and intuitive GUI I have seen on Linux
lightweight
reasonable fast
integrates SVN
also available on other OS flavours(Windows, MacOS, Solaris(?))
Cons:
no CVS integration (that's important for me because I have to use it at work)
no support for Java, Perl, Python (would be nice to have)
Code::Blocks
Eclipse CDT
Soon you'll find that IDEs are not enough, and you'll have to learn the GCC toolchain anyway (which isn't hard, at least learning the basic functionality). But no harm in reducing the transitional pain with the IDEs, IMO.
A quick answer, just to add a little more knowledge to this topic:
You must definitely check out NetBeans. Netbeans 6.7 has the following features:
C/C++ Projects and Templates: Supports syntax highlighting,
automatic code completion, automatic indentation.
It has a C/C++ Debugger
Supports Compiler Configurations, Configuration Manager and Makefile Support (with a
Wizard).
It has a Classes Window, a Usages Window and a File Navigation Window (or panel).
A Macro expansion view, and also tooltips.
Support for QT development.
I think it's a perfect (and far better) Visual Studio substitution, and a very good tool to learn C/C++.
Good Luck!
At least for Qt specific projects, the Qt Creator (from Nokia/Trolltech/Digia) shows great promise.
could you clarify a little bit more how it was for you, what you had to change. Maybe you could point me in the right direction by providing some links to the information you used.
My first source were actually the tools' man pages. Just type
$ man toolname
on the command line ($ here is part of the prompt, not the input).
Depending on the platform, they're quite well-written and can also be found on the internet. In the case of make, I actually read the complete documentation which took a few hours. Actually, I don't think this is necessary or helpful in most cases but I had a few special requirements in my first assignments under Linux that required a sophisticated makefile. After writing the makefile I gave it to an experienced colleague who did some minor tweaks and corrections. After that, I pretty much knew make.
I used GVIM because I had some (but not much) prior experience there, I can't say anything at all about Emacs or alternatives. I find it really helps to read other peoples' .gvimrc config file. Many people put it on the web. Here's mine.
Don't try to master all binutils at once, there are too many functions. But get a general overview so you'll know where to search when needing something in the future. You should, however, know all the important parameters for g++ and ld (the GCC linker tool that's invoked automatically except when explicitly prevented).
Also I'm curious, do you have code completion and syntax highlighting when you code?
Syntax highlighting: yes, and a much better one than Visual Studio. Code completion: yes-ish. First, I have to admit that I didn't use C++ code completion even in Visual Studio because (compared to VB and C#) it wasn't good enough. I don't use it often now but nevertheless, GVIM has native code completion support for C++. Combined with the ctags library and a plug-in like taglist this is almost an IDE.
Actually, what got me started was an article by Armin Ronacher. Before reading the text, look at the screenshots at the end of it!
do you have to compile first before getting (syntax) errors?
Yes. But this is the same for Visual Studio, isn't it (I've never used Whole Tomato)? Of course, the syntax highlighting will show you non-matching brackets but that's about all.
and how do you debug (again think breakpoints etc)?
I use gdb which is a command-line tool. There's also a graphical frontend called DDD. gdb is a modern debugging tool and can do everything you can do in an IDE. The only thing that really annoys me is reading a stack trace because lines aren't indented or formatted so it's really hard to scan the information when you're using a lot of templates (which I do). But those also clutter the stack trace in IDEs.
Like I said, I had the 'pleasure' to set my first steps in the Java programming language using windows notepad and the command line java compiler in high school, and it was, .. wel a nightmare! certainly when I could compare it with other programming courses I had back then where we had decent IDE's
You shouldn't even try to compare a modern, full-feature editor like Emacs or GVIM to Notepad. Notepad is an embellished TextBox control, and this really makes all the difference. Additionally, working on the command line is a very different experience in Linux and Windows. The Windows cmd.exe is severely crippled. PowerShell is much better.
/EDIT: I should mention explicitly that GVIM has tabbed editing (as in tabbed browsing, not tabs-vs-spaces)! It took me ages to find them although they're not hidden at all. Just type :tabe instead of plain :e when opening a file or creating a new one, and GVIM will create a new tab. Switching between tabs can be done using the cursor or several different shortcuts (depending on the platform). The key gt (type g, then t in command mode) should work everywhere, and jumps to the next tab, or tab no. n if a number was given. Type :help gt to get more help.
Not to repeat an answer, but I think I can add a bit more.
Slickedit is an excellent IDE.
It supports large code-bases well without slowing down or spending all its time indexing. (This is a problem I had with eclipse's cdt). Slickedit's speed is probably the nicest thing about it, actually.
The code completion works well and there are a large amount of options for things like automatic formatting, beautification and refactoring.
It does have integrated debugging.
It has plug-in support and fairly active community creating them.
In theory, you should be able to integrate well with people doing the traditional makefile stuff, as it allows you to create a project directly from one, but that didn't work as smoothly as I would have liked when I tried it.
In addition to Linux, there are Mac and Windows versions of it, should you need them.
As an old-time UNIX guy, I always use Emacs. But that has a pretty steep and long learning curve, so I'm not sure I can recommend it to newcomers.
There really isn't a "good" IDE for Linux. Eclipse is not very good for C/C++ (CDT is improving, but is not very useful yet). The others are missing all the features you are going to be looking for.
It really is important to learn how all the individual tools (gcc, make, gdb, etc.) work. After you do so, you may find the Visual Studio way of doing things to be very limiting.
Checkout Netbeans, it's written in Java so you'll have the same environment regardless of your OS, and it supports a lot more than just C++.
I'm not going to try to convince you, because I think IDEs can be a very personal choice. For me it improves my productivity by being fast, supporting the languages I code in and has the standard features you'd expect from an IDE.
Just a quick follow up for this question...
It's been a month since I started using Vim as my main 'GUI'
tool for programming C++ in Linux. At first the learning
curve was indeed a bit steep but after a while and with the
right options turned on and scripts running I really
got the hang of it!
I love the way how you can shape Vim to suite your needs;
just add/change key mappings and Vim is turned into a
highly productive 'IDE'.
The toolchain to build and compile a C++ program on Linux is
also really intuitive. make and g++ are the tools you'll
use.
The debugger ddd is however not really that good, but
maybe that's because I haven't had the time to master it
properly.
So to anyone who is, or was looking for a good C++ IDE in
Linux, just like I was, your best bet lays with the standard
available tools in Linux itself (Vim, g++, ddd) and you
should really at least try to use them, before looking for
sonething else...
Last but not least, I really want to thank konrad for
his answer here, It really helped me find my way in the
Linux development environment, thank you!
I'm also not closing this question, so people can still
react or maybe even add new suggestions or additions to the
already really nice answers...
I recommend you read The Art Of UNIX Progranmming. It will frame your mind into using the environment as your IDE.
Shorter answer is: choosing whatever "editor" you like, then use GDB console or a simple GDB front end to debug your application. The debuggers come with fancy IDEs such as Netbeans sucks for C/C++. I use Netbeans as my editor, and Insight and GDB console as my debugger.
With insight, you have a nice GUI and the raw power of GDB.
As soon as you get used to GDB commands, you will start to love it since you can do things you will never be able to do using an GUI. You can use even use Python as your script language if you are using GDB 7 or newer version.
Most people here paid more attentions to the "Editors" of the IDEs. However, if you are developing a large project in C/C++, you could easily spend more than 70% of your time on the "debuggers". The debuggers of the fancy IDEs are at least 10 years behind Visual Studio. For instance, Netbenas has very similar interfaces with Visual Studio. But its debugger has a number of disadvantages compared to Visual Studio.
Very slow to display even a array with only a few hundreds of elements
No highlighting for changed value ( By default, visual studio shows changed values in the watch windows in red)
Very limited ability to show memory.
You cannot modify the source code then continue to run. If a bug takes a long time to hit, you would like to change the source and apply the changes live and continue to run your application.
You cannot change the "next statement" to run. In Visual Studio, you can use "Set Next Statement" to change how your application runs. Although this feature could crash your application if not used properly, but it will save you a lot of time. For instance, if you found the state of your application is not correct, but you do not know what caused the problems, you might want to rerun a certain region of the your source codes without restarting your application.
No built-in support for STL such as vector, list, deque and map etc.
No watch points. You need to have this feature, when you need to stop your application right at the point a variable is changed. Intel based computers have hardware watch points so that the watch points will not slow down your system. It might takes many hours to find some hard-to-find bugs without using watch points. "Visual Studio" calls "watch pointer" as "Data BreakPoint".
The list can be a lot longer.
I was so frustrated by the disadvantages of the Netbeans or other similar IDEs, so that I started to learn GDB itself. I found GDB itself are very powerful. GDB does not have all the "disadvantages" mentioned above. Actually, GDB is very powerful, it is even better than Visual Studio in many ways. Here I just show you a very simple example.
For instance, you have a array like:
struct IdAndValue
{
int ID;
int value;
};
IdAndValue IdAndValues[1000];
When your application stops, and you want to examine the data in IdAndValues. For instance, if you want to find the ordinals and values in the array for a particular "ID", you can create a script like the following:
define PrintVal
set $i=0
printf "ID = %d\n", $arg0
while $i<1000
if IdAndValues[$i].ID == $arg0
printf "ordinal = %d, value = %d\n", $i, IdAndValues[$i].vaue
set $i++
end
end
end
You can use all variables in your application in the current context, your own variables (in our example, it is $i), arguments passed (in our example, it is $arg0) and all GDB commands (built-in or user defined).
Use PrintVal 1 from GDB prompt to print out values for ID "1"
By the way, NetBeans does come with a GDB console, but by using the console, you could crash Netbeans. And I believe that is why the console is hidden by default in NetBeans
I am using "Geany" found good so far, its fast and light weight IDE.
Among Geany’s features are:
Code folding
Session saving
Basic IDE features such as syntax highlighting, tabs, automatic indentation and code completion
Simple project management
Build system
Color picker (surprisingly handy during web development)
Embedded terminal emulation
Call tips
Symbol lists
Auto-completion of common constructs (such as if, else, while, etc.)
If you like Eclipse for Java, I suggest Eclipse CDT.
Despite C/C++ support isn't so powerful as is for Java, it still offers most of the features. It has a nice feature named Managed Project that makes working with C/C++ projects easier if you don't have experience with Makefiles. But you can still use Makefiles.
I do C and Java coding and I'm really happy with CDT. I'm developing the firmware for a embedded device in C and a application in Java that talks to this device, and is really nice to use the same environment for both. I guess it probably makes me more productive.
I love how people completely miss the request in the original question for an IDE. Linux is NOT an IDE. That's just not what those words mean. I learned c and c++ using vi and gcc and make, and I'm not saying they aren't adequate tools, but they are NOT an IDE. Even if you use more elaborate tools like vim or emacs or whatever fancy editor you want, typing commands on a command line is not an IDE.
Also, you all know make exists as part of visual studio right? The idea that an IDE is "limiting" is just silly if you can use the IDE to speed some things, yet are still able to fall back on command line stuff when needed.
All that said, I'd suggest, as several above have, trying Code blocks. Its got decent code highlighting, a pretty effortless way to create a project, code it, run it, etc, that is the core of a real IDE, and seems fairly stable. Debugging sucks...I have never seen a decent interactive debugger in any linux/unix variant. gdb ain't it. If you're used to visual studio style debugging, you're pretty much out of luck.
Anyway, I'll go pack my things, I know the one-view-only linux crowd will shout this down and run me out of town in no time.
make + vim + gdb = one great IDE
I quite like Ultimate++'s IDE. It has some features that were designed to use with their own library (which, BTW, is quite a nice toolkit if you don't want to buy on either GTK+ or QT) but it works perfectly well with general C++ projects. It provides decent code completion, good syntax colouring, integrated debugging, and all other features most modern IDEs support.
I really suggest codeblocks. It's not as heavy as Eclipse and it's got Visual Studio project support.
Perhaps the Linux Tools Project for Eclipse could fill your needs?
The Linux Tools project aims to bring a full-featured C and C++ IDE to Linux developers. We build on the source editing and debugging features of the CDT and integrate popular native development tools such as the GNU Autotools, Valgrind, OProfile, RPM, SystemTap, GCov, GProf, LTTng, etc. Current projects include LTTng trace viewers and analyzers, an RPM .spec editor, Autotools build integration, a Valgrind heap usage analysis tool, and OProfile call profiling tools.
On Linux there are plenty of IDEs:
Code::blocks
Codelite
KDevelop
Qt Creator
Eclipse with CDT
NetBeans
In my experience, the most valuable are Eclipse and Qt Creator.
Both provide all "standard" features (i.e., autocompletion, syntax highlightning, debugger, git integration).
It is worth noting that Eclipse also provides refactoring functionalities, while Qt Creator provides integration with Valgrind and support for deployment on remote targets.
Also the commercial CLion IDE seems preety good (but I've not used it extensively).
I hear Anjuta is pretty slick for Gnome users. I played a bit with KDevelop and it's nice, but sort of lacking featurewise. Code::Blocks is also very promising, and I like that one best.
Sun Studio version 12 is a free download(FREE and paid support available) -- http://developers.sun.com/sunstudio/downloads/thankyou.jsp?submit=%A0FREE+Download%A0%BB%A0.
I'm sure you have code completion and debugging support including plugin support in this IDE.
Sun Studio is available for Linux as well as Solaris.
forums : http://developers.sun.com/sunstudio/community/forums/index.jsp.
Sun Studio Linux forums : http://forum.sun.com/forum.jspa?forumID=855
I'll be eager to hear your feedback on this tool.
BR,
~A
I've previously used Ultimate++ IDE and it's rather good.
And then I noticed that this simply isn't how you work there*, and I threw everything out, spent a few days reading manuals, set up my shell (bash), set up a GVIM environment, learned the GCC/binutils toolchain, make and gdb and lived happily ever after.
I'd mostly agree, but the problem is also one of perception: we forget how difficult it was to become productive in any chose IDE (or other environment). I find IDE's (Visual Studio, NetBeans, Eclipse) amazingly cumbersome in so many ways.
As an old-time UNIX guy, I always use Emacs. But that has a pretty steep
and long learning curve, so I'm not sure I can recommend it to newcomers.
I'd second that; use Emacs as my primary editor on both Linux and on MSW (XP2,W2K).
I would disagree that it has a steep learning curve, but would say that because of the huge number of features it has a long learning curve. You can be productive within a short time, but if you want you can learn new features of it for years to come.
However -- don't expect all the features of Emacs to be available on drop-down menus, there is just too much functionality to find it there.
As I metioned, I've used GNU Emacs on MSW for years. And it's always worked well with Visual Studio until I "upgraded" to 2008; now it sometimes delays many seconds before refreshing files from disk. The main reason for editing in the VS window is the "Intellisense" code completion feature.
geany I recommend
Although I use Vim, some of my co-workers use SlickEdit which looks pretty good. I'm not certain about integrated debugging because we wouldn't be able to do that on our particular project anyway.
SlickEdit does have good support for navigating large code bases, with cross referencing and tag jumping. Of course it has the basic stuff like syntax highlighting and code completion too.
I use Eclipse CDT and Qt Creator (for Qt applications).
That's my preferences. It's a very suggestive question and there is as many answers as there is developers. :)
SlickEdit. I have used and loved SlickEdit since 2005, both on Windows and on Linux. I also have experience working in Visual Studio (5, 6, 2003, 2005) and just with Emacs and command line. I use SlickEdit with external makefiles, some of my teammates use SlickEdit, others use Emacs/vi. I do not use the integrated debugger, integrated version control, integrated build system: I generally find too much integration to be real pain. SlickEdit is robust (very few bugs), fast and intuitive. It is like a German car, a driver's car.
The newest versions of SlickEdit seem to offer many features that do not interest me, I am a little worried that the product will become bloated and diluted in the future. For now (I use V13.0) it is great.
For me Ultimate++ seems to be the best solution to write cross-os program
If you were using vim for a long time, then you should actually make that as your IDE. There are a lot of addons available. I found several of those as pretty useful, and compiled it here, have a look at it.
C/C++ IDE
Source code browser
And a lot more in the vi / vim tips & tricks series over there.