Unix on Windows?

Hello guys,
I'm currently learning how to program in c++. I use CodeBlocks for this. I learn it through a book. Until now, everything was ok, I understood all about classes, functions etc.. Now, in the next chapter, they suddenly write something about unix, makefile and commands.
Now I'm really confused. It isn't some kind of function, is it?
As I'm only a newbie in programming, I have no idea what they are now talking about.

So I did a little research. Is it true that you can only compile in UNIX if you have Linux? Or what about the GNU compiler? So compiling in UNIX does not work with CodeBlocks?

I hope you understand what my problem is. It is so confusing to me. Please tell me, if you have problems understanding my question!
I use CodeBlocks for this ... they suddenly write something about unix, makefile and commands.
Now I'm really confused. It isn't some kind of function, is it?
As I'm only a newbie in programming, I have no idea what they are now talking about.
Codeblocks is an example of what we call an Integrated Development Environment (IDE). It integrates a source code editor, perhaps a resource editor, a compiler, linker and debugger.

An alternative is to use your own editor, do the compile/link yourself and run the debugger yourself. That usually involves working from a text console/terminal. And that's why you need to know about the console/terminal commands.

Make is a program that automates the compile/link cycle? Why bother with make when you can just run the compiler? Because compiles can take some time, and you don't always need to compile everything, and make works out what needs to be compiled.
http://www.cplusplus.com/articles/jTbCpfjN/

You don't need to learn Unix commands. If you're on Windows, you interact with the Windows console. But you can learn Unix commands on Windows. You'll need to install Cygwin, it provides a Unix shell on Windows and a package manager for installed Unix things.
http://www.cygwin.com/

Now I'm really confused. It isn't some kind of function, is it?
I hope you now understand that isn't the case.
closed account (Dy7SLyTq)
and mingw is the windows equivalent to gcc
closed account (S6k9GNh0)
MinGW is more than just a compiler, it's an environment. It provides a minimalist GNU toolchain, including gdb, gcc, ld, gold.ld, etc.

MinGW includes an implementation of GCC but MinGW != gcc
closed account (Dy7SLyTq)
hmmm did not know that. thanks for that computer quip. its not a gui gold right? just a command-line version?
If your wanting a more "authentic Linux" experience on Windows, you could check out Mintty
http://code.google.com/p/mintty/

I've only just come across it, being relatively new to Linux-style programming. But Mintty works with MSYS (which I use with MinGW) as well as CYGWIN (where it's the default terminal.)

Andy
closed account (S6k9GNh0)
I dont' know how it would provide a GUI version... it's just tools that would sit underneath a GUI. You can use them with say.. Code::Blocks or CodeLite.
Ok, thanks for the answers! But I still have 3 more questions:

1. Until now, I have only programmed console applications. But I'd love to be able to import texts (for example from notepad) or save strings, ints, etc. into a text file. I thought that you'd be able to do that with console applications, if you know UNIX. So this isn't the case?

2. Why would I want to program in Linux/Unix, when I program in Windows? I have heard a lot about programming in Linux already, so I do wonder...

3. How important is it to be able to use UNIX (at least the basics?)

closed account (S6k9GNh0)
I don't really get what you think "knowing Unix" means.

1. Console applications or Window applications aren't really limited to things like that. File IO is a OS provided facility and is interfaced by the OS. C, C++, POSIX, and various other APIs provide a facility that makes this interface completely abstract from the OS itself.

2. Programming for other platforms isn't really a direct intention most of the time. You program with the idea that other platforms could use the code in an abstract manner and then just code for whatever you want. There's no real reason to code for another platform when you won't use it yourself and you don't plan on releasing the code to others.

In an example, all of my code, especially my 3D rendering code, runs on all platforms that I can think of that supports a C++98 compilier, an OpenGL 3 implementation. I do this because OpenGL is cross-platform and file IO is cross-platform using C fopen/fclose.

3. I don't know what you mean.
1. Until now, I have only programmed console applications. But I'd love to be able to import texts (for example from notepad) or save strings, ints, etc. into a text file. I thought that you'd be able to do that with console applications, if you know UNIX. So this isn't the case?
You can do that sort of thing using Standard C++. If you stick to the standard, your code will work on any C++ environment, whether it be on Windows, Unix, ReactOS or an IBM Mainframe. That's the point of the standard.

2. Why would I want to program in Linux/Unix, when I program in Windows? I have heard a lot about programming in Linux already, so I do wonder...
Of course, you don't have to use Linux or Unix. But Linux is mainstream now, and it would be useful for you to understand something about it. But there's also 3 popular mobile platforms that may be work learning. It's your choice.

3. How important is it to be able to use UNIX (at least the basics?)
All the Windows people I know have needed to learn something about Linux/Unix and all the Unix people I know have been picking up Windows skills (as I keep being told by LinkedIn).

You need to understand that there's a Windows way of doing things and that way is different from the Unix way. If you want to get your head around it, it probably best to read about it first. Programming is just implementing an idea, it's best to have the ideas before think about writing code.

The Art of Unix Programming by Eric S. Raymond.
http://www.faqs.org/docs/artu/
Last edited on
Linux OS's heavily dominate the server and supercomputer domains.

All my programming courses at community college, and at the University I'll soon be attending, are taught in a Linux environment.

One of the most common jobs for Computer Science graduates is Linux system administrator.

Linux is open source, and that is at least part of why it sees so much use in high performance and critical systems. Users like google can modify the source to customize their system, they can examine the source code and be confident in exactly what it does and how it works, they can examine security flaws and address them, etc.
Last edited on
Topic archived. No new replies allowed.