tags:

views:

532

answers:

10

Hi,

Since you 'should' learn C/C++ and as part of 'learn as much languages as possible', i decided to learn C++ in depth.

My OS is Windows and my question is should i re-install Linux as a dual boot to learn C++ on Linux?

Do i miss something if I develop in C++ only on the Windows platform?

(possible duplicate: http://stackoverflow.com/questions/1128050/best-operating-system-for-c-development-and-learning)

+3  A: 

Not really if you don't use OS specific calls or libs.

If you are asking about IDEs, compilers etc, that's a metter of your preferences about it.

klez
+7  A: 

Doesn't really matter what platform you write your code on.

If you want to verify that your code is portable, you could install cygwin and gcc as well as visual studio.

Then you could compile with both compilers without having to dualboot

Glen
+6  A: 

If you want to practice / test on Linux, you can simply create a virtual machine, for example with VirtualBox.

Zed
Why not the opposite?
LiraNuna
Because I'm a hardcore gamer and i need C# for my work ;) Lets not start a flame war (A)
ReDAeR
@LiraNuna: Because he already has Windows installed?
Zed
+1  A: 

If, in the process of learning C and C++, you want to see how the libraries and the system actually work, Linux is the obvious choice as you can take a look at the system's entire source code.

IMHO, that can be quite instructive.

ndim
+2  A: 

First of all, learning "as many languges as possible" is less important than learning at least one programming language in depth first.

In my view, you should learn programming on the platform than you are most familiar with. If you are not familiar with Linux and it's features yet, it's no use to start learning programming with it because you wouldn't know what to do. You can also expect the MS documentation to be a bit more consistent than the Linux docs.

Some more things to consider:

  • You should get a ready-to-use development environment like Eclipe or MS Visual C++ (Windows). Getting the "standard way" with text editor, makefiles, etc. to work is too hard for a beginner, especially on Windows.
  • If you are going to use .NET on Windows, you have to be aware that the language is slightly different from standard C++. The same is true for C++ Builder, etc. If you are using Visual C++ or an environment based on the GNU compiler, you can program standard C++.
  • You should try to use C++ standard APIs and libraries like the STL, not MS-proprietary libs, except if you want to stick to Windows.
mh
I'm familar with Linux and I'm not a beginner. But if you look at job descriptions you often see C++ in combination with Linux so i wondered if C++ Linux is different then C++ Windows. Any thing that Linux is better in, eg: networking.
ReDAeR
OSs are like languages, there isn't a better one. It should be selected as the better tool for a given job...
Panic
@Panic Gaming on Linux is a no go but i see your point, every project should be approached differently.
ReDAeR
@ReDAeR: The systems are different, but you can't say that Linux is "better" in general (although Linux geeks might see this differently ;-)).I'd say, make a decision which system you want to learn first, maybe chose a project to implement, and finish it. After that, you can do the same on the other platform to learn about the differences.If you want to do network programming, I'd suggest starting with Linux because in this area, the corresponding UNIX APIs are the de-facto cross-platform standard and Windows is an "exotic" system (where libs emulating corresponding UNIX APIs exist).
mh
Thank you, mh. So UNIX is better if want to learn about networking programming. As project i'm trying to make a text editor in the console, something like nano.
ReDAeR
@ReDAeROn UNIX and Windows, the code to control terminal output (e.g. move the cursor, output something at a specific position, ...) is totally different. I remember terminal stuff being documented badly on Windows, so this might be a reason to do it with Linux first, but it was many years ago that I was programming in this area, so it might have improved in the meantime.
mh
I started working on it today, if you are interested: http://pastebin.com/f356b0274
ReDAeR
+7  A: 

If your goal is simply to learn C++, it doesn't matter what platform you use because C++, as a general purpose programming language, is not platform-specific. You can learn standard C++ on any platform with a decent C++ compiler.

Charles Salvia
+1  A: 

Since with C++ alone you will not be doing much, you should use both OSs (and more) to understand what is available to you in terms of libraries, compilers and IDEs (even development philosophies vary from OS to OS), this is not really important on your first steps into C++, at that stage it is more important which compiler/IDE you select...

Zed above rightly points you out the virtual machine option, VirtualBox is great.

Personally I would advise to avoid using Visual Studio as your first IDE/Compiler, it will add increased complexity and attempt to brainwash you into .net at every chance it gets. It will also make it hard for you later on to move to other setups...

Start with a simple text editor (Notepad++ on windows) and by using the command line for compilations.

Panic
On the other hand, a good IDE (be that Visual Studio, Qt Creator, others which can be found in other questions here) helps when you start. It gives you a map of the classes, helps with completion, has integrated help, makes it easier to spot the errors after compilation... I wouldn't turn that down.
RedGlyph
I feel that without using an IDE, when one does compile or link via command line manually gives more insight on the various compiler options/flags, which in turn throws more light towards the languages' nuances. Sure it's easy to use an IDE, but it abstracts all these and I know people who've 3 years of experience without knowing when compiler options their projects invoke.
legends2k
@RedGlyph - Don't get me wrong, Visual Studio even after being bloated as it is (after the v6) is the if not the best compiler one of the top and has the best IDE (even if it has lots of problems) the major one being pushing .net and insidiously attempting to lock you into the platform. One of my pet peeves about posts on stackoverflow.com is seeing people refer to C++ as unmanaged C++...
Panic
+4  A: 

Do i miss something if I develop in C++ only on the Windows platform?

Valgrind.

LiraNuna
There are a lot of other really useful tools on Linux. All in all, those tools make Linux quite developer friendly... very much in contrast to Windows.
ndim
I'd say the tools make Linux expert-friendly, but not beginner-friendly.
StackedCrooked
+1 for valgrind.
Michael Aaron Safyan
+1  A: 

I recommend that you stick with Windows for a while until you gain some familiarity with the language. Then you can switch to Linux if you like. I say this because on Windows you can use Visual Studio (the Express Edition can be downloaded for free). Its user friendliness will ease some of the pain caused by the initial hurdles when learning C++.

Eventually you should also learn the Linux/Unix way by using gcc, makefiles and an advanced editor like vi/emacs/whatever.. However, this by itself is already challenging stuff, so save it for later and learn C++ first.

StackedCrooked
On the other hand, starting with Visual Studio will give you non-standard stuff like "stdafx.h" as well as all of Visual Studio's particular "#pragma" statements (e.g. "#pragma warning").
Michael Aaron Safyan
+1 Not sure why you were down-voted for common sense... He's already using Windows, states he's using C# (most likely Visual Studio), and using non-standard stuff is *optional*
Stuart
@Michael Aaron Safyan: not if you check the "Empty project" setting when creating your solution. Non-standard stuff has never posed a problem for me.
StackedCrooked
+1  A: 

As long as you stick with cross-platform libraries (e.g. the C++ Standard Library, the Boost C++ Libraries, and the Qt Framework), instead of using platform-specific calls (e.g. the WIN32 API), and also assuming you use a cross-platform build system (e.g. CMake), instead of a platform-specific system (e.g. Visual Studio), then it won't matter. That said, it is much easier to setup a C/C++ development environment on Linux than it is to setup the equivalent development environment on Windows. And, since Linux will not include the "windows.h" header, you will be less likely to invoke Windows-specific features if you develop on Linux.

Michael Aaron Safyan