I used turbo c++ in windows to write c/c++ codes. Recently I started using Ubuntu, now where should i write c/c++ code in Ubuntu like we used to do in windows? Which software should I download from Ubuntu app store to write code? Please note that I am not asking how to compile I am asking where to and in which software to write code.
In my opinion, there is no need for any IDEs to compile and execute most of the programs in c/c++.
You can use any text editors like Gedit, nano , Vi/Vim to write the code and compile it using
g++ which are installed by default.
Install the (sufficient) packages for once.
sudo apt-get install build-essential
Next time, To compile a c program, Go to terminal, and execute :
gcc /path/to/your/program/my_c_program.c -o outputfile.out
To Execute the compiled file,
You can know more about gcc and g++ from its man pages.
man gcc man g++
When youre looking for an IDE there are many possibilities of which I want to cover one, its is called Code::Blocks and runs cross platform (Windows/Linux) you can install it from the standard repositories with
sudo apt-get install codeblocks
The following screen-shot gives you an idea of the UI of it.
All other answers so far just suggest and IDE. When you say "Please note that I am not asking how to compile I am asking where to and in which software to write code." I understand the where to as also asking which compilers to use.
The first place to start for C/C++ is the the Gnu Compiler Collection (GCC). The easiest way to install GCC plus the other essentials for building software is to install the
build essential meta package:
sudo apt-get install build-essential
Now you have a compiler you need and IDE. This, as everyone points, out is a personal choice. Some examples are:
Kate: Awesome, but usage requires a bit of extra knowledge.
I really like Kate, a simple text editor, where you can customise its behaviour for each type of file. You can also set up projects (this currently involves manually writing a project file) and get a terminal in as a panel in Kate. I then compile using my own
make files. This is rather hands on, but gives you more fine grained control and understanding of what is going on.
Code::Blocks: More simple to use, but in my opinion more overbearing than kate.
As previously mentioned Code:Blocks is a fully functional IDE available for Linux and Windows. The makes it easy to if you want the same IDE when working on both platforms. It also has the "benefit" of graphical tools for setting up compiler options, and a simple button to easily compile simple programs.
Eclipse CDT I have heard it is popular, personally too huge and clumbersome for my taste
Eclipse is a huge cross plattform Java IDE, but it has plugins for developing almost anything else. The CDT plugin is for C/C++. I looked at the IDE briefly and had no love for it. I admit this may not be fair judgement but I saw no benefits over say Code::Blocks and a quick check of apt shows that to install Eclipse and Eclipse-cdt would require 237 MB of archives, Code::Blocks is 6.4 MB, and Kate is simply the standard KDE text editor which comes with my Kubuntu (0.5 kB package, but an unfair comparison as it is already installed so I am not sure what the dependencies would be on vanilla Ubuntu). I am not saying Eclipse is bad per se, just that I see no reason why any IDE should require 1/4 of a GB of space.
There are, of course, many many other options.
You have a lot of editors to choose from. I am using Geany for writing the code and gdb for debugging, because the applications I write need special environment where running IDE would not be a good idea. I have seen many people using Eclipse, which also supports GUI for debugging with the help of gdb.
You should look and find the one that suits you the best. Take a look here for some descriptions: https://stackoverflow.com/questions/24109/c-ide-for-linux
Source code is text, so any text editor will do...
That said: most programmers appreciate lexical (syntax) highlighting and many text editors offer that (certainly any that we're going to talk about), as well as some basic tools that will make coding generally easier and more efficient (tabs, windows, search/replace, etc.).
This question really has everything to do with preference. Since there are no special criteria in the question that help narrow down better suggestion this answer will be necessarily broad but I will attempt to provide enough information that you can determine which option(s) might best satisfy your preferences.
Why do so many people put this at the end? Let's get it out of the way, right now.
If you want to skip reading to the end: I use vim in the terminal, Atom in a desktop environment and if I was recommending a general-purpose IDE then it would probably IntelliJ IDEA, but I rarely use an IDE anymore.
There are many options, I'll give a couple in each of three categories (I have used each of these in development, (albeit some very briefly):
Terminal Text Editors
This is home turf to many people engaged in coding in a Unix-like environment. You have advantages when developing remotely using simple tools like ssh, etc. and there is basically zero impact on the system... These tools are so light weight and fast that, I kid you not, some people I have worked with actually want something clunkier... you know something that, "feels like a program is running".
Vim is my favorite and what I use more often than any of the examples that I'll be listing here, or in any category. If you're a touch typer and want an editor which you can configure to be exactly what you need and don't really want to ever have to reach for the mouse... these and many other nerdy wonders await you in vim. It's fast and efficient, and once you get used to it you will wish [insert anything here] was as cool as vim.
Nano is another common suggestion in this category; In my opinion, whereas it might be simpler starting out, ultimately vim is a superior product. I have used it and did not find any advantage over Vim, except for a somewhat shallower learning curve... but people who think you can't become effective writing in Vim in your first session... sorry, almost because a tangential off-topic rant.
I'll mention Emacs as another obvious option but it's not one I have used so cannot recommend personally, it has however (as does vi/vim) a cult-like following and probably at least a few of those followers are using it for practical reasons.
Note that the above are all free
GUI Text Editors
If you don't live in the terminal, and/or don't want to, then there are some really good text editors, which feature add-ons that can make your coding more pleasant and efficient, and are yet much lighter and quicker than a
fully-bloated full-blown IDE.
I am dead split between suggesting Atom and Sublime Text. I have used and enjoyed both.
Atom is wide open and hackable. There are more and more community-built tools coming out everyday. They can tweak everything from looks to function. There is no end to the fun there. It is also free and open-source.
Sublime is not open source, nor is it free (but it's cheap and 110% worth the price, which at this writing is $70). It does currently run a little quicker and look a little nicer than Atom. It is also very configurable, if a little more locked up than Atom.
The comparison between these two is natural to me; they are natural competitors and very similar, have the same target audience, etc. I neither like one more than the other, nor would suggest one over the other. It's really about preferences, they are both able tools.
And since Atom if free, and Sublime is free to try, there is no harm in testing out both.
Honorable mention goes out to Kate (and cousin KDevelope) and Gedit; good tools, but I think if you like those you owe it to yourself to at least look at Atom and Sublime, which I prefer at least.
OK. Full disclosure: I am biased and walked away from IDEs a while back and have no real desire to go back. That said, some programming (like Android) appears to almost require an IDE. In my opinion they are bloated and slow far out of proportion to any gains you get from them.
Those I have used: Eclipse, IntelliJ IDEA, Android Studio, NetBeans.
I would recommend IntelliJ IDEA over the others. But if you like Eclipse (many, many people do) then it's basically the same. I mean they all get you to where you're going, I just have had the fewest annoying moments working in IntelliJ IDEA than in the others.