The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.
It's driving me crazy, do I really have to download all of that just to be able to program in C++? I don't even know where to get everything in the prerequisites, much less where to put them.
You appear to have found the instructions for compiling gcc from source. It sounds like this is more than you bargained for. What you are likely looking for is a pre-compiled binary for your operating system (Windows, Linux) and processor architecture (32-bit or 64-bit is likely the only relevant distinction).
For example, Googling "g++ windows binary" is likely to find you a g++ version someone has built for windows that will just run instead of requiring all that rigmarole you linked. Obviously, this will vary depending on who's decided to build things for what platforms; hence the above question.
Edit edit: if you're with a university or the like that can get you it for free, Visual Studio (and its Visual C++ compiler) is also a fairly common environment for working in C++.
Edit edit: if you're with a university or the like that can get you it for free, Visual Studio (and its Visual C++ compiler) is also a fairly common environment for working in C++.
Edit edit: if you're with a university or the like that can get you it for free, Visual Studio (and its Visual C++ compiler) is also a fairly common environment for working in C++.
You appear to have found the instructions for compiling gcc from source. It sounds like this is more than you bargained for. What you are likely looking for is a pre-compiled binary for your operating system (Windows, Linux) and processor architecture (32-bit or 64-bit is likely the only relevant distinction).
For example, Googling "g++ windows binary" is likely to find you a g++ version someone has built for windows that will just run instead of requiring all that rigmarole you linked. Obviously, this will vary depending on who's decided to build things for what platforms; hence the above question.
Edit edit: if you're with a university or the like that can get you it for free, Visual Studio (and its Visual C++ compiler) is also a fairly common environment for working in C++.
Assuming that you didn't accidentally click past the component checklist when you installed MinGW (which would have been easy to do) and that g++ is actually installed, did you check the /bin folder in your MinGW install for mingw32-g++.exe? It looks like that's it when I run it from the command prompt.
Edit: not to be pedantic if you already know all this, but "bin" stands for "binary" and holds all the executable programs on a Unix-style setup like the one G++ generally wants to use.
Edit edit (Disclaimer): I haven't actually used MinGW before; it just looked like what you needed when I did a Google search.
That's because it's complaining that you didn't give it any c++ files to compile, and the command window won't stay open if you double-click it from Explorer. You need to open a command prompt ("cmd") and run it from in there, preferably passing it the files you want to compile.
If you don't want to have to browse to the MinGW install directory every time you want to compile, that can be arranged, but for now I'd recommend just making sure it works.
Edit: you can get a command prompt by going Start > "cmd" (on Vista/Win7) or by going Start > Run... > cmd on XP and older.
MinGW will pretty much only provide you with a basic set of compilers and C/C++ libraries, targeted for windows. It won't provide an IDE or much in the way of automated help/projects/etc.
You're going to wind up editing text files with a text editor (grab something at least slightly sane like notepad++ so you get at least basic syntax highlighting), and then building them with (initially) commands like gcc/g++ to compile, along with various flags for including useful libraries, etc.
Moving on from there, you can use Makefiles to automate compilation, add additional libraries for more shortcuts (eg, SDL for games, etc). You can probably find some free IDEs that support mingw as well, although i can't recall any off the top of my head.
Visual studio Express (c++ edition) might shortcut things a bit for you, but that means you're using microsoft's c++ version, not the cross-platform c++ version that'll work on windows/linux/etc. Up to you there.
If you're feeling really game, you can write code that'll work in both, with a little bit of preprocessor magic and work (not actually a bad thing, can help you spot bugs, since both compilers will flag warnings for different possibly bad things). Of course, knowing the language reasonably well before you start that kind of thing is probably a good plan
I'm surprised that, when installing mingw, it didn't provide a command prompt, but i'm guessing it just added stuff to the system's PATH (or you possibly need to do that yourself).
There seem to be a variety of different (and probably conflicting) discussions of how to get started with mingw on windows. http://elegy.mie.uiuc.edu/mediawiki/index.php/MinGW seems to stand out as short and sweet, but i haven't tried it myself.
YMMV, I guess. I will say that what you're trying to do may be easier if you're familiar with a linux environment, if only because the tools are more ingrained into the usual way of doing things .
MSVC++ will be easier to use. Command line compilers can be a pain in the ass, particularly when needing to include other files as well. It turns into a big giant mess of a command line entry, whereas with MSVC++ it will automatically include the files you have in a particular project.
Having used both I just use the express version of MSVC++ when using Windows just because it's easier. Knowing how to do both is nice, but given the choice and the know-how there's little reason to choose the more tedious option.
That's because it's complaining that you didn't give it any c++ files to compile, and the command window won't stay open if you double-click it from Explorer. You need to open a command prompt ("cmd") and run it from in there, preferably passing it the files you want to compile.
If you don't want to have to browse to the MinGW install directory every time you want to compile, that can be arranged, but for now I'd recommend just making sure it works.
Edit: you can get a command prompt by going Start > "cmd" (on Vista/Win7) or by going Start > Run... > cmd on XP and older.
I'm at the command prompt. What do I do from there? Sorry that I ask such noob questions.
Visual studio Express (c++ edition) might shortcut things a bit for you, but that means you're using microsoft's c++ version, not the cross-platform c++ version that'll work on windows/linux/etc. Up to you there.
In that case, does using Microsoft's C++ version have drawbacks? I mean, I want to learn as much as I can, but what is used more often?
If you want to develop windows software, the MS IDEs are pretty much the standard. If you want to develop for Unix and Linux based platforms, gcc is where it's at.
Long term, it'll be good to learn to compile from the command line using gcc. There are plenty of tutorials on doing that and it's pretty straightforward for small apps with just a single .cpp file or two and a few headers. At least on Linux. I've never done it on Windows.
Basically, you will need to add the /bin folder of minGW to your windows PATH variable (through My Computer -> properties -> advanced -> environment variables I believe), then on the command line, just type:
g++ a.C
where a.C is some C++ source file, and it will make a.exe.
Good luck. You may also want to get nmake.exe in order to use Makefiles in windows. This is another can of worms. (EDIT: actually scratch this - MinGW comes with its own "make", along with a bunch of other cool utilities)
People who can't stand this stuff should probably stick with visual studio.
Visual studio Express (c++ edition) might shortcut things a bit for you, but that means you're using microsoft's c++ version, not the cross-platform c++ version that'll work on windows/linux/etc. Up to you there.
In that case, does using Microsoft's C++ version have drawbacks? I mean, I want to learn as much as I can, but what is used more often?
There are differences in the implementation of the C++ language in microsoft's compiler, when compared to GCC's. I'm not going to comment on which is more correct, or which has better features, etc. There are pros and cons on both sides.
What using VS and MS's C++ compiler gets you is a more seamless way to use .NET, Win32 and other assorted technologies. That said, you can write the exact same program both ways, the limits being that there are pain points in accessing assemblies that're compiled using one environment in the other, and vice versa.
It depends ultimately on what your goal is. If you're learning, either environment is okay. I'd favour the GCC implementation, as they're probably closer to the language spec (provided you specify a specific array of compiler flags to avoid GCCisms) for learning purposes. If anything, i'd suggest using *both*. They will install side-by-side, you know
For simple stuff, while learning, you'll find it easier to do it in one, and requires you to *understand* when it comes time to get the same thing working in the other (for instance, relying on unix system calls on windows, etc).
That said, to start with? Don't worry about that question. A better question would be: What're you going to use to learn C++? A book? What environment does the book target? (some may assume GCC/unix, some may assume VC++, some may try to be as agnostic as possible). I'd avoid books that target a specific IDE, at least initially. IDE's are productivity enhancers, to be sure, but they also allow for bad habits to go unnoticed or even encouraged, and may encourage very platform-specific behavior, if you're interested in cross-platform portability.
Visual studio Express (c++ edition) might shortcut things a bit for you, but that means you're using microsoft's c++ version, not the cross-platform c++ version that'll work on windows/linux/etc. Up to you there.
If you're feeling really game, you can write code that'll work in both, with a little bit of preprocessor magic and work (not actually a bad thing, can help you spot bugs, since both compilers will flag warnings for different possibly bad things). Of course, knowing the language reasonably well before you start that kind of thing is probably a good plan
With the exception of a very few things that MSVC isn't standards-compliant to, and having to use Windows libraries instead of Linux ones (if you can't find cross-platform ones), you can write the exact same code in MSVC and in Linux. Microsoft doesn't have a "C++ version" as such; there are a few things that MSVC does differently, but they're unlikely to be an issue. The main problem arises when you want to use other libraries: if they only support Windows, then you won't be able to compile in Linux, and vice versa.
Sounds like you'd be better off in Visual Studio, which automates a lot of the process for you. For example, as well as gcc you'll need to know some kind of build system like make or jam to do anything useful.
If you're worried about cross platform compatibility, use Visual Studio but use stl or boost libraries as much as possible in your code and steer clear of the windows libraries. If you do that it generally wont take much to port to linux.
If you want to get started in programming, learn how to do the compiling from the console - it isn't difficult. Windows programmers will tell you to use MSVC++ but frankly that IDE babies you so much it frankly isn't conducive to the learning experience.
so i see alot of people recommending learning from the command line, and ill have to disagree, atleast to some point.
Ideally you should start with learning from the command line and the use of different compile flags and include paths and whatnot, it will give you a solid understanding of how things work and all that.
If you just want to get coding, go with MSVC++, get code cranked out instead of becoming frustrated with obscure compileflags and stuff not compiling because your forgetting some obscure option.
Once comfortable with C++ and having gotten your hands wet with C++, by all means mess around with the command line tools.
Posts
Windows?
Linux?
Other?
For example, Googling "g++ windows binary" is likely to find you a g++ version someone has built for windows that will just run instead of requiring all that rigmarole you linked. Obviously, this will vary depending on who's decided to build things for what platforms; hence the above question.
Hope that helps.
Edit: if you're on Windows, maybe this will help?
http://sourceforge.net/projects/mingw/files/
Edit edit: if you're with a university or the like that can get you it for free, Visual Studio (and its Visual C++ compiler) is also a fairly common environment for working in C++.
As an alternative, the Express Editions are also free.
Thank you so much.
I installed MinGW 5.1.6 but I don't even know how to start it. The only executables I see are an uninstaller and an updater, and there is also a URL.
Edit: not to be pedantic if you already know all this, but "bin" stands for "binary" and holds all the executable programs on a Unix-style setup like the one G++ generally wants to use.
Edit edit (Disclaimer): I haven't actually used MinGW before; it just looked like what you needed when I did a Google search.
That's because it's complaining that you didn't give it any c++ files to compile, and the command window won't stay open if you double-click it from Explorer. You need to open a command prompt ("cmd") and run it from in there, preferably passing it the files you want to compile.
If you don't want to have to browse to the MinGW install directory every time you want to compile, that can be arranged, but for now I'd recommend just making sure it works.
Edit: you can get a command prompt by going Start > "cmd" (on Vista/Win7) or by going Start > Run... > cmd on XP and older.
You're going to wind up editing text files with a text editor (grab something at least slightly sane like notepad++ so you get at least basic syntax highlighting), and then building them with (initially) commands like gcc/g++ to compile, along with various flags for including useful libraries, etc.
Moving on from there, you can use Makefiles to automate compilation, add additional libraries for more shortcuts (eg, SDL for games, etc). You can probably find some free IDEs that support mingw as well, although i can't recall any off the top of my head.
Visual studio Express (c++ edition) might shortcut things a bit for you, but that means you're using microsoft's c++ version, not the cross-platform c++ version that'll work on windows/linux/etc. Up to you there.
If you're feeling really game, you can write code that'll work in both, with a little bit of preprocessor magic and work (not actually a bad thing, can help you spot bugs, since both compilers will flag warnings for different possibly bad things). Of course, knowing the language reasonably well before you start that kind of thing is probably a good plan
I'm surprised that, when installing mingw, it didn't provide a command prompt, but i'm guessing it just added stuff to the system's PATH (or you possibly need to do that yourself).
There seem to be a variety of different (and probably conflicting) discussions of how to get started with mingw on windows. http://elegy.mie.uiuc.edu/mediawiki/index.php/MinGW seems to stand out as short and sweet, but i haven't tried it myself.
YMMV, I guess. I will say that what you're trying to do may be easier if you're familiar with a linux environment, if only because the tools are more ingrained into the usual way of doing things .
Having used both I just use the express version of MSVC++ when using Windows just because it's easier. Knowing how to do both is nice, but given the choice and the know-how there's little reason to choose the more tedious option.
I'm at the command prompt. What do I do from there? Sorry that I ask such noob questions.
In that case, does using Microsoft's C++ version have drawbacks? I mean, I want to learn as much as I can, but what is used more often?
http://www.bloodshed.net/devcpp.html <- I've never used it, but I believe this is the most common mingw/gcc IDE for windows.
Long term, it'll be good to learn to compile from the command line using gcc. There are plenty of tutorials on doing that and it's pretty straightforward for small apps with just a single .cpp file or two and a few headers. At least on Linux. I've never done it on Windows.
Basically, you will need to add the /bin folder of minGW to your windows PATH variable (through My Computer -> properties -> advanced -> environment variables I believe), then on the command line, just type:
g++ a.C
where a.C is some C++ source file, and it will make a.exe.
Good luck. You may also want to get nmake.exe in order to use Makefiles in windows. This is another can of worms. (EDIT: actually scratch this - MinGW comes with its own "make", along with a bunch of other cool utilities)
People who can't stand this stuff should probably stick with visual studio.
There are differences in the implementation of the C++ language in microsoft's compiler, when compared to GCC's. I'm not going to comment on which is more correct, or which has better features, etc. There are pros and cons on both sides.
What using VS and MS's C++ compiler gets you is a more seamless way to use .NET, Win32 and other assorted technologies. That said, you can write the exact same program both ways, the limits being that there are pain points in accessing assemblies that're compiled using one environment in the other, and vice versa.
It depends ultimately on what your goal is. If you're learning, either environment is okay. I'd favour the GCC implementation, as they're probably closer to the language spec (provided you specify a specific array of compiler flags to avoid GCCisms) for learning purposes. If anything, i'd suggest using *both*. They will install side-by-side, you know
For simple stuff, while learning, you'll find it easier to do it in one, and requires you to *understand* when it comes time to get the same thing working in the other (for instance, relying on unix system calls on windows, etc).
That said, to start with? Don't worry about that question. A better question would be: What're you going to use to learn C++? A book? What environment does the book target? (some may assume GCC/unix, some may assume VC++, some may try to be as agnostic as possible). I'd avoid books that target a specific IDE, at least initially. IDE's are productivity enhancers, to be sure, but they also allow for bad habits to go unnoticed or even encouraged, and may encourage very platform-specific behavior, if you're interested in cross-platform portability.
For unfathomable reasons. It's incredibly out-of-date. Code::Blocks does everything it does and more, AFAIK, and can even open Dev-C++ project files.
Edit: For those interested, here are the areas where MSVC doesn't meet the standard.
If you're worried about cross platform compatibility, use Visual Studio but use stl or boost libraries as much as possible in your code and steer clear of the windows libraries. If you do that it generally wont take much to port to linux.
Ideally you should start with learning from the command line and the use of different compile flags and include paths and whatnot, it will give you a solid understanding of how things work and all that.
If you just want to get coding, go with MSVC++, get code cranked out instead of becoming frustrated with obscure compileflags and stuff not compiling because your forgetting some obscure option.
Once comfortable with C++ and having gotten your hands wet with C++, by all means mess around with the command line tools.