Learning Linux from Windows Newbie questions [closed] - c++

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 6 years ago.
Improve this question
I am a newbie in linux and programming. I want to learn linux command and use create some C and C++ programme to interact with the linux API from my windows XP. However, I am not sure how to set up the environment from my windows based computer.
What programme should I install? Also, it seems like linux has Ubuntu, Fedora. I heard of Red Hat as well. What is the difference and which one should I install?
Also, is there any difference between using linux with user interface like Ubuntu, using an IDE to create programme AND the command line terminal using VIM to create programme?
Besides, I have heard of using Valgrind to debug programme. Does Valgrind works together with an IDE in Ubuntu or works in command line terminal only? If my IDE already has debugger, do I still need Valgrind?
Sorry for such newbie questions.
Thanks.

Your question is very vague and prone to start argumentations and fights. Also, you miss-used many terminologies there and before you even start programming with Linux, you should first get acquainted with the OS, especially the terminal... But first things first, programming in C/C++ for Windows is not entirely the same as programming in C/C++ for Linux. If you want the latter, then use the latter.
My suggestion is this :
Grab VirtualBox and install it.
Download Ubuntu ; IMHO, Ubuntu is best for starters (or anyone as a matter of fact) because it has a lot of support, a good user base and is compatible with pretty much any Linux software installer (RPM, deb, etc.) You can choose any other distribution, it doesn't really matter, but I recommend this one. [1]
Start VirtualBox and create a new Ubuntu virtual machine. The steps are pretty straight forward, consult the documentation for any assistance). Your virtual machine may look something like :
1GB of RAM will be enough;
10GB of hard disk (you won't need much more, but you may increase the size if you think you'll need more space for /home, see next point)
a network adapter set a bridged
etc.
Install Ubuntu from the ISO that you have just downloaded (that you have mounted into VirtualBox as a CD-ROM device) You'll only need about 8GB of hard disk total for a typical, minimum Ubuntu installation (ext4+swap), however I recommend this setup.
Enjoy your installation. (Tip: now you can install the VirtualBox's Guest Additions.)
Open a terminal in your Ubuntu VirtualBox window and type sudo apt-get install build-essential to install the GCC compiler
Gedit is already installed by default with Ubuntu and it's a fairly good text editor compared to Windows' notepad. However, vim is not, but you can install it with sudo apt-get install vim in the terminal.
And voilà! You're all set to go to do some C/C++ programming in a Linux environment, where you can still have Windows in case you're stuck.
I also recommend you do most of your learning using the terminal (aka the command line) so you know how things work under the hood. Then, when you are familiar with the GCC compilier, MAKEFILEs, etc. you can install some IDE to avoid repeating tasks; The two best I have yet found are Ajunta and MonoDevelop. Both are available from the repositories.
Now, if you want to "create some C and C++ programs to interact with the linux API from [your] windows XP", You need, for example, to learn sockets and SSH; so you can connect to your Linux machine from your Windows machine and execute some commands remotely from your Windows applications. But before you do that, learn C/C++ and play around with Linux. For a newbie, you already have your hands full right there.
Good luck!
[1] Ubuntu (a Linux distribution) comes with Gnome as GUI, while Kubuntu with KDE and Xubuntu has XFCE. All of them (GUIs) are separate projects and you could have all of them installed on any Linux desktop installation. Even, you don't need any GUI with any Linux distribution; for example, VMWare's Virtual Appliance Marketplate have a whole bunch of ready-to-go Linux installations like that.

Try it with a VM or as a live-cd.
Valgrind is a command-line tool but maybe some IDEs use integrated it.
Under Linux you'll see, than most of the time an IDE is quite useless (not a troll).
You'll do your Makefile manually,...
Hope you'll enjoy' it.
Regards,

Learn 1 thing at a time.
If you want to learn to program first, try python first. It works in Windows and Linux and you get result faster
If you want to learn C++, get Visual C++ express or Cygwin/GCC
If you want to experience with Linux, get a distribution of your choice (Linux-Mint is a good introction, coming from Windows) and try it in a VM (VMWare Player or VirtualBox)
Try easy projects and only after that, worry about debuggers

If you try it in virtual machines (virtualbox or WMWare for example) you can test as many options you want before deciding what Linux distro you will want to use. There are a lot, but from what you listed, my personnal opinion is that Ubuntu is a lot easier than Fedora to start. I've never used RedHat so I can't tell but it hasn't the reputation of beeing a hard one (for experts).
Anyways, at least to start I recommend installing it with GUI (and after starting too unless it's a server...).
Regarding IDEs, you could try Eclipse and Netbeans. They run both on Windows and Linux but I'm not C/C++ programmer so I don't know if they are good at that job. I you don't use IDE, Vim is far from beeing the unique option (Vim "addicts" :) will say it is the unique productive one but that's a personnal choice and the learning time is not very short). Personnaly I prefer a good IDE or at least graphical editors for programming, not that I don't like the power and speed of the terminal with command line as I prefer to use it for system administration or configuration but not for programming where you stay a long time on it.
I don't know about Valgrind but Eclipse or Netbeans IDEs have debuggers of course.

Programming for Linux a series of projects to learn, for the steps, you may refer to:
Red Hat Certified System Administrator I &II student-book which may help you to get the survival abilities in Linux, actually when you really understand the fields covered by these courses, you will have got the ability to find what to learn.
Search amazon with keyword 'Linux Programming', choose one and start your journey.
Have a good time.

Related

Installing OCaml

I would like to start programming in OCaml. As I am a Windows user, I understand that it is preferred to do so using the OCaml plugin for Netbeans.
I have downloaded the aforementioned plugin from the following link: http://ocamlplugin.loki-a.com/ocamlplugin/updates/ . I have installed the plugin into Netbeans as instructed. I managed to open a project but even the sample "Hello World" won't run.
I then tried to install the OCaml IDE from here: http://ocamlplugin.loki-a.com/index.php?title=Main_Page#Download_2 , but it still wouldn't run anything.
I am not interested in working with Eclipse because that would include downloading Cygwin.
I would appreciate a simple solution. Thank you! :)
I would suggest OCaIDE under Eclipse, if you stick to Windows anyway.
But I don't understand your reluctancy to use cygwin, especially when there is such nice step-by-step tutorial for configuring cygwin for OcaIDE and Eclipse.
Another option, which I haven't tried but would strongly suggest you trying, is Sublime Text 2. It supports OCaml and is a very popular cross-platform text editor. But since I haven't tried it, I would not be able to provide you with details about it. Although it comes with a cost, you can evaluate it for free without time limit.
TypeRex has been my favourite for OCaml so far, and you can now use Emacs in Windows, so with some workaround in cygwin you can use TypeRex in Windows.
Another option is to use VirtualBox, install a normal linux distro and use Typerex+Emacs inside it. It is also not complicated, as it takes 1 hour to config at most.
The ocaml links that you gave have not been touched since 2009 (4 years ago). That probably means the odds of them running with the current NetBeans are equivalent to the proverbial sphere of solidified water in the Christian place of eternal theological punishment.
Since you are asking about running under Cygwin, it sounds like you want a Linux version of Eclipse as well. Eclipse runs quite well under Win7, at least, and under Mint (I use them under both) However, all my attempts to get ANY OCaml IDE running under either system have been borged (resistance is futile, and depends and capacitance anyway).
So, under Mint 15, emacs and vim (the old standards) work well as text editors. I wish I could suggest anything else.
Good luck!!!
By now, another option has appeared for Windows 10 users wanting to use OCaml: the Windows Subsystem for Linux.
Basically, what it does is that it allows you to run Bash and any non-GUI Linux program on your PC. Once installed, you can install OCaml and OPAM with apt-get and you're good to go.
As far as I am concerned, I use Windows 10 on my desktop PC, and I haven't had any inconvenience with WSL yet.
I personally use Merlin/... which is are plugins for emacs. But I can understand that you dont want to use emacs. I have been told that the support with Visual Studio Code is supposed to be quite good, especially when using it together with the builtin console. Also for smaller things there is Ocamltop but I have now idea how the Windows support is. In the end I suggest, using the Linux Shell on Windows as RichouHunter suggests.

What are some ways that I can develop C++ apps in Linux from a Windows workstation?

I'm developing C++ apps for Linux, but my workstation is Windows 7. I've read that Visual Studio is the strongest C++ IDE for Windows, but I actually want to execute the code on Ubuntu and be able to use a more graphically pleasing debugger than gdb, although the functionality of gdb is pretty good. I'm really happy with valgrind as well, but again, I'd like to be able to leverage that in an IDE in windows.
I currently use QtCreator as my C++ IDE and I edit the files over a samba mount to the linux box. I use Putty to run the Linux commands. I use git as my source control system, gcc as my compiler and cmake as my build system. I like QtCreator, but as I have it configured, I'm not taking advantage of code-completion or debugging.
The closest thing I've seen is CodeWarrior. It allows for executing code on remote embedded systems and a full debugger. Has anyone ever used this for general app development on Ubuntu?
Is QtCreator the right IDE for me? Is there something else that I can do to configure it so that it'll give me those rich IDE features that I'm looking for? Or should I look to another IDE? Also, are there some tools that I've neglected to mention that would make C++ development easier on a Linux box from a Windows workstation?
Thanks in advance...
It is not clear, you run QtCreator on windows?
If so, you can run QtCreator in Linux,
plus install nxserver on Linux,
and nxclient on windows (http://www.nomachine.com/).
So you run nxclient on windows, login to linux,
and work on linux, in compare with virtual machines,
you get more prefomance.
Use VirtualBox and linux virtual machines?
X Windows.
You could install Cygwin to run an X11 server on your Windows 7 desktop, then run an X11 graphical IDE like QtCreator on your Linux server that renders directly to your Cygwin Windows 7 desktop. I actually tried setting this up with Code::Blocks on openSUSE and Cygwin on Windows 7 just a few weeks ago because I'm in the same situation you're in. It works... kind of. There are weird intermittent errors.
Your scenario is exactly the scenario that the X Windows system was designed for, and it is awesome in concept, but the actual X11 protocol design and implementation is, I gather, old and pretty hairy. I have very little experience with X, but the people who do have lots of experience with it seem to complain about it a lot, and I suppose there are good reasons for that. Too bad, because it would be wonderful if there were a technology like X Windows that worked. AJAX is basically a cheap hack for solving the same kind of problem that X Windows tried to solve... running a remote application with local rendering of a rich GUI.
I gave up on X and I still do the same thing you do: I have putty and Samba-mounted files that I edit with Visual Studio. Visual Studio is the best text editor I've ever used. All the other Visual Studio IDE features are gravy.
There's some solutions :
VmWare : not free but really good
Virtualbox : free but less powerfull than VmWare
KVM/Qemu : Free but less powerfull than VmWare

Which Linux distribution should I go for learning C/C++/Assembly in Linux

I am a primary windows developer with experience in C#, .NET, Visual C/C++. I want to lean C/C++ development in linux in order to create portable GUI applications which run on both Windows and Linux.
I have used Fedora in past (2005). Want your suggestions to know which is the best distribution currently to learn programming in linux.
You can't really go wrong with any of the major ones. Personally I use Debian, but Fedora and OpenSUSE are good choices as well.
I would also like to point out that you can use C# to create portable GUI applications. Have a look at Mono and Gtk#. I have developed quite a few Gtk# apps and they usually run flawlessly on Windows and Linux, with very little work on my part. It might not be a bad introduction to coding on Linux, as you will be able to use a familiar language.
Any modern Linux distribution will do, as they all includes (or makes it easy to install) GCC. To easily create portable GUI applications, I would recommend taking a look at Qt.
Since every distro worth its salt has a Development Package that includes gcc, g++ and gdb, it's really going to come down to the IDE you develop your code in. Eclipse is an excellent IDE for C & C++ which just happens to be written in java. So long story short, use whatever distro you are comfortable with, it really doesn't matter all that much.
There is none Distribution you couldn't use. If you want an easy distribution working almost out of the box. With a lot of things configured automatically i would suggest you use ubuntu.
If you like to do more things on your own I'd tend to debian. Anyway you could simply code with qt and use the linux box for debugging only.
Slackware, ArchLinux or CentOS.
Stay away from Ubuntu and its derivatives, you will spend more time messing with packet manager apt-get than doing code. If you choose Debian-derivatives you will spend time wondering why your programs dont work only to find out you need packetname-devel also (!)
A base Slackware install should be enough to get you started, if you would like to keep having the latest programs, use ArchLinux.
You wrote "to create portable GUI applications which run on both Windows and Linux" - I suggest that you consider Qt (used to be from Trolltech now part of Nokia). http://qt.nokia.com/products/

Setting up a Programming Environment in Linux [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I recently started using Linux as my primary OS. What are the tools that I will need to set up a complete programming environment in Linux for C and C++?
Standard stuff:
The compiler tools, gcc, gdb, etc.
Some sort of editor/IDE (emacs, vim, eclipse)
Profiling tools
Source Control (SubVersion, git, etc)
Language specific tools, like easy_install for python (you said C/C++, but the same goes for everything)
A web server maybe? Apache, Lighttpd, nginx
Any libraries you'll be using. Are you doing kernal hacking? Driver development? opengl?
Among others you should also have gprof and valgrind ( or something in it's class ).
Vi (or emacs), gcc , make
Tradiationally unix development is more commandline than ide. There are very good IDEs, the main ones are probably eclipse and kdevelop
It depends on your definition of "Complete programming environment", and whether you are using C, C++, or both (C/C++ is an awful term that shouldn't be used. Either it's C, or C++).
If you are looking for an IDE, Eclipse/CDT is the most highly-recommended one from my experience (I don't actually use any IDE, so I can't offer first-hand advice).
If you can cope with command-line control (and in the end I find it makes things easier to do and doesn't take a whole lot of getting used to), a simple text editor with highlighting will suffice. I prefer KATE (part of KDE), as it features a built-in terminal as well as many features you would expect from an editor inside an IDE, like code folding and regex search/replace.
Many people also recommend Vim or Emacs, both of which are probably available through your distro's repositories. (Eclipse is probably available too, but in my experience the CDT is confusing to install via packages. YMMV). They are both ancient editors; and there is a powerful holy war between the two, so I won't get involved.
Your compiler should probably be GCC - on a Debian system, installing the g++ package as well as build-essential should be enough to get C++ going (build-essential should contain the gcc package required for C development). Whatever your distro, GCC is probably easily available or else already on your system.
Seconding swilliams, I'd say the basics are:
an editor or IDE (I use vim),
a compiler (almost certainly gcc)
make, or maybe some other similar tool like ant if you want
a debugger (almost certainly gdb)
source control (I use subversion)
Standard unix utilities like grep and diff, but you have those already
Other than that, I'd say install as you go. Linux is more about little utilities that each do one thing than monolithic development environments that do everything. So if you find yourself needing something, you can always just install it, be that thing a memory profiler, a documentation generator, a bigger/smaller/more different editor, et cetera, et cetera.
What distribution are you running?
In Ubuntu or any Debian based distribution you can issue the following command to install all the necessary tools.
sudo apt-get install build-essential
From there you can install your SCM solution of choice and an IDE if you prefer or just use your favorite text editor.
The simplest of answers is an editor (take your pick - at least one is already on there) and gcc/g++.
If you want an IDE, there are a slew of questions related to that on SO :) (including this one C++ IDE for Linux?).
Kdevelop is a well regarded and well written IDE for Linux, installing it should get you every other tool you might want to develop with installed as well and and IDE to go with it.
By "every other tool" I mean gcc, grep, diff, autoconf et al should be grabbed by the package manager and installed at the same time, but I could be wrong. I don't have a standard distro on hand to test that with.
Personally, I use vim, but I have used kdevelop in the past.
vim/vi is handy because you know that some form of vi is always available on every unix platform.
I have to correct my post. I just looked at the package requirements for kdevelop on ubuntu... it does NOT appear to require gcc and install it automatically
If you want something very easy to use, with ability to import visual studio projects, and a feel much like VS, give Codeblocks a try. Its quick ( since its not Java based ) and in general works well.
Another great utility that you can use are *nix man pages. Each function in the C library has an associated man page.
For example:
man printf
man strncpy
...
I took an old windows laptop with a dead hard drive and
replaced the hard drive then installed Ubuntu (linux / debian
all in one handy release) on it. I had to burn the ubuntu
installation files onto a cd first on another working computer.
Here's where I got my linux from (complete with desktop gui, very
easy to install, lots of programs to use, it was my first linux
but not my first unix):
http://www.ubuntu.com/getubuntu/download
Then i installed Netbeans for my integrated development environment (IDE)
altough I am using it for java -- but it comes with c++ support as shown below:
http://www.netbeans.org/features/cpp/
I also installed mySql, you didn't ask, but that is another key component
that completes my development environment.
Good luck to you.
On most distros, everything you need will be installed by default (very few don't include gcc, they all include some kind of editor). I generally do my development in Vim (or gVim, which is the graphical version -- the best of both worlds). For those times when I'm feeling the need for a "real" IDE, Eclipse with the Vim plugin is really nice. It's almost like working in Vim, except you get the Eclipse stuff -- again, best of both worlds. The Vim plugin for Eclipse that I'm using is not free, however :( I believe there is a free one, but the last time I tried it, it wasn't very good.
Personally I use Ubuntu w/ Eclipse CDT. Eclipse is what most people might think of as a Java IDE, but CDT is a set of extensions that really tune it for C/C++ development. It's smart enough to figure out what toolset to use (MacOSX GCC vs Linux GCC, for example).
Eclipse CDT Website
For best results, currently the 6.0 JRE for Ubuntu seems to have problems with recent Eclipse versions, so what I did was remove the 6.0 JRE and run:
apt-get install build-essential
sun-java5-jre sun-java5-bin
Then grab the latest Eclipse from the website, unpack it in a directory.
As a final touch, edit the eclipse.ini file that comes with Eclipse and add this line to it:
-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith
This will further stabilize the app, making it as rocksolid as Windows or Mac.
If you prefer commandline tools over GUI tools, some ones I use regularly:
CMake -- Portable build tool. It's easy to use and can output a variety of formats like Makefiles or Visual Studio files.
apt-get install cmake
Vim -- VI improved, if you want a text editor with some bells and whistles. Otherwise, just use 'nano', which comes with Ubuntu.
apt-get install vim
Twe options, you must make your decision now and never look back, or risk being burned at the stake:
a. Emacs
b. vi(m)
Do not listen to any rational arguments before choosting... listen to the light inside yourself...
Install a lot of bell a whistles for the editor you choose, vi is usable but no fun.
vim is fun, but vim with extras is great.
(And the same is true for Emacs even if that means installing tetris and a doctor ;-) )
/Johan
Two must haves are guake and pithos. I cant see how any one can have a list of dev tools without these.

How to get started with Maemo software development [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
A few months ego I purchased Nokia N800 device and since then I'm itching to write some code for it. I know that some of the application I'm running are written in Python and that there is a Mono port for the Maemo platform as well.
Basically what I'm asking is:
Is there a recommended development language for Maemo platform?
What development tools exist?
Can I use Windows or Linux as my primary development machine, and which do you recommend and why?
I highly suggest that you try C++ and QT.
QT is already well supported for Diablo and Fremantle, and the next release of Maemo (Harmattan) should be based on QT.
Learning QT will be much much easier than GTK+, coding will be faster and more fun, your application can be compiled in various platforms and you can even develop and debug in Windows, then simply run a qmake && make in a scratchbox environment.
Take a look at this tutorial: Getting started wit QT for Maemo
You still need a Linux box to compile your code for a Maemo device.
If you are using windows, you can setup ubuntu (or kubuntu) in a VirtualBox machine.
Maemo SDk + along with Scratchbox 2 is a better alternative than Maemo SDk & Scratchbox.
Personnally, I'm using QT creator in Windows, kubuntu 9.04 in VirtualBox, and I've never been happier.
When I started, I tried the "official" approach : Ubuntu, GTK+, C language and scratchbox 1. ... that was painful.
The Hildon framework is made up of GTK+ extensions, so the language is C. You can use C++ wrappers (maemomm) too. Or you can go with pymaemo for building apps with Python, which to me is much easier than C or C++. I've also seen an attempt at a ruby port, but have not followed up with that project recently.
For the development environment, there is "scratchbox", which gives you a sandbox for compiling and running your app. Here's a link on how to set up a scratchbox development environment. (It sure took me a long time to get everything setup.)
You'll have to use Linux as your development machine because your Nokia N800 is really a mini Linux computer.
If you want to have an IDE experience, try the ESbox plugin for Eclipse.
Have fun hacking!!!
I've just found two tutorials on Maemo.org:
Writing Hildon Desktop Plug-ins for Maemo 3.x
How to write maemo desktop plugins for maemo 4.x
For extra on-the-go fun, you can get the linux gcc and make tools running on the tablet itself and do your programming and compiling on the device.
For any help with this sort of stuff the Maemo Talk forums are fantastic.
Ruby for Maemo is being hosted at http://code.scottishclimbs.com/maemo/
I've not yet tried it myself.
There's a Scratchbox Virtual Appliance for Maemo development (I'm not sure if the link is the right one) but that's how I started hacking. It took forever for me to figure out how to set up scratchbox by myself.
I have to echo Karatchov's response.
The 2 recommended approaches currently are:
Python + PyGtk
C++ & Qt
Using anything else, you set yourself up for some pain (unless you are a Gtk+ veteran - since you are asking this question, I assume you are not). C++ & Qt is the future of Maemo anyway, and Qt works well on "old" platforms such as Diablo.
As a debugger, I recommend you pick up (compile) "cgdb". The plain old gdb can be a bit too spartan.
Generally, you should develop your application as a "normal" Qt application using Qt Creator, and occasionally test it in scratchbox.
Nokia has been working hard to provide tools and documentation for developers. I would say one of the best places to start is at Forum Nokia:
http://www.forum.nokia.com/Technology_Topics/Device_Platforms/Maemo.xhtml
The next stop for developing for Maemo is of course Maemo's headquarters:
http://maemo.org/development/
These two links are to portals where you'll have to drill down for further info, but they are pretty good starting points. Now to answer your questions directly:
I suppose the two 'recommended' languages are C and python. While these are well supported, they are not the only choices as you have seen from previous answers. In addition to those languages, perl is on the device, though it is not in the same state as it is on debian.
The chief development tool is the SDK. It allows you to test the environment and compile software for the device. You can also use Eclipse for which there are plugins.
It is recommended that you use linux as a development machine, but you can run it in a virtual machine on Windows. While I prefer my OS to be 100% free and therefor choose debian, Nokia is working hard to make a better development environment for Windows. So rest assured that Nokia does not necessarily share my bias! :-)
I develop mainly with python and pyside (I develop on an N900).
I have all my files in the nokia N900 and I use sshfs to mount my home directory on my pc.
I then develop on my desktop, while actually saving everything right into the cell phone, and use SSH to run it remotely.
If you get too lazy to even pick up the device to look at the screen, you might want to use VNC; though personally, I feel it's just not responsive enough.
Yes, all I have on my desktop is my editor (sublime-text, by the way). The rest live on the mobile device. I use git to sync things/make backups, etc.
py2deb is great for making packages once you want to distribute your proyect. Again, no need to install anything on your desktop.
IF you'd rather be more conservative, the SDK is designed for debian, and you'll suffer a lot with any non-debian-based OS (unless you use a VM). Be warned! :)