I hope I'm posting this okay and don't irritate anyone TOO much with my ignorance. I appreciate the patience and help!
I'm trying to take programming back up again and learn C++, but it appears everything is standing in my way. To my shame I bought the C++ All In One for Dummies book, to realize I can't even do the very first program because either the code is too outdated (Heard it was) or the software (Compiler/IDE/et.al.) wasn't all there.
Anyways, Is anyone able to help direct me to even get STARTED? My programming knowledge is limited to me being well-versed in VB, but I've not programmed in over Seven years.
I'm having trouble getting anything to work. I've tried the simple Hello World program. Yet, using Code::Blocks it kept saying the compiler was not a valid one so I couldn't even build the thing to test it out. Then when I changed compilers, it gave me a plethora of warnings (no errors though), and would not do a thing when I tried to start the program.
I did the same thing in Microsoft Visual C++ 2008 Express Edition, yet the console closes immediately. I saw the problem was that no pause was being placed into the code. Understandable.
But I'd like to use THIS site to learn C++, yet I'm worried about using the MSVC++ IDE because . . . well isn't it more than just an IDE? Isn't it for a different code language altogether?
Please forgive me for my ignorance in all this. I've searched, and tried to figure this out myself but it appears I can't find the answer anywhere else, and all tech in the world is out to stop me from learning C++!
Thank you, again, for any and all help you can offer!
What code are you using for your helloworld? & What version of code::blocks do you use? Code blocks runs perfectly fine for me, have you selected the appropriate project type?
A very basic version of hello world(w/ using namespace) would be:
This website gives a very quick but shallow understanding of basic c++ concepts, if you'd like to learn things a bit more in depth, with exercises and review questions along with deep explanations, I recommend you to check out the book(available in e-book format as well) C++ Primer Plus 5th Edition(Stephen Prata) . I read something about a 6th edition coming out soon updated to 2011 standards.
Yet, using Code::Blocks it kept saying the compiler was not a valid one so I couldn't even build the thing to test it out.
Code::Blocks has two downloads: one with the MinGW suite, and the other without it. If you download the Code::Blocks with MinGW, your IDE is ready to go without the need to configure the compiler.
HisServant77 wrote:
yet the console closes immediately.
You could call system( "Pause" ) but it's highly recommended that you don't. Since you're struggling with the simplest of programs, then I suppose your could use it, but don't lean on it.
HisServant77 wrote:
well isn't it more than just an IDE?
I haven't notice anything that would lead me to believe that's more than an IDE.
HisServant77 wrote:
Isn't it for a different code language altogether?
That would depend on the IDE you download. Here's a few of them:
1) Microsoft Visual C++ Studio/Express 2010/2008
2) Microsoft Visual C#
I'll provide some links so that you can get started, again.
References:
Learn C++: http://www.learncpp.com/
This Site: http://www.cplusplus.com/doc/tutorial/
Tutorials Point: http://www.tutorialspoint.com/cplusplus/index.htm
I'm not sure what my problem is with the Code::Blocks giving me the trouble it is with the compiler, since I had read the same suggestion and downloaded the one with MinGW suite as well and it still gave me the trouble.
Yet, since MSVC++ IS just an IDE and all, as you said, I'll just have to use that one until I understand better, I suppose. That was a main concern: trying to learn C++, and using MSVC++ with the concern it'd try to teach me another form of C++ I wasn't aiming to learn.
I'd rather figure out the issue and use Code::Blocks, but I may have to learn more first.
OK. If you insist on using Code::Blocks then I'll help you configure it.
1) Download Code::Blocks with the MinGW suite (assuming you haven't done this already).
2) Run the executable.
3) When you reach the Choose Components stage of the installer, make sure MinGW Compiler Suite is checked.
4) When the program installation completes, run Code::Blocks.
5) A dialog box will appear, listing the detected compilers. The GNU GCC compiler should have Detected next to it. Click the OK button.
6) Navigate to: File >> New >> Project and select the Console Application template. Once the template it selected, press the Go button.
7) Another dialog box will appear. Click Next.
8) Yet another dialog box will appear. This time, you choose the language you want to use. Select C++ and click the Next button.
9) Another dialog box will appear. Fill in the fields as required then press the Next button.
10) Another dialog box will appear. This time, just press the Finish button.
11) On the left-hand side pane, expand the Sources filter and double-click on main.cpp.
12) Press the F9 key and it should compile.
I hope these steps help you :)
[Note: Code::Blocks automatically halts program termination without manually coding in a stop function]
Oh, man, sorry for seeming to ignore you up there, Georgewashere! I must've not seen your post, only Framework's. That is the code I couldn't seem to get working, the one you listed. Very basic and all. It just wasn't working for me. The biggest thing was, I believe, the pause. It would shut down instantly. But I understand the issue with that one and how to possibly fix it. Thanks for the book recommendation, I'll have to check that one out so that I have a better understanding of C++. I definitely am the type to want to learn everything, not just enough to get by. My problem is mostly this Code::Blocks issue it seems now . . .
Framework, Thanks again for the help and patience. I had C::B installed, but uninstalled it for this scenario here. Upon installing it this time, it seemed to completely skip step 5 up there! But if I recall correctly, I don't remember seeing that the GNU GCC compiler was Detected when I first installed this. Yet when I go to: Help>>Plugins>>Compiler
It does show it there. I tried to run the very basic Hello World project yet again, with the same results "...uses an invalid compiler. Skipping . . . " Sheesh . . . I again say, all these things are set out against me to try to stop me from learning and programming with C++ haha
I'm mostly just wanting to use C::B for the main reason of unity, using the same one as I learn, and I heard MSVC++ might not be good for creating programs later on that would work on a non-microsoft OS. But it appears, for the time being, that I'll have to just use it until I learn more...I just don't want to be limited in what I learn, or try learning one thing only to have the IDE I use, change anything or suggest another thing that is OS-specific or something, understand what I mean? Do you use and/or suggest a different one yourself?
I do greatly appreciate your help and continued patience in this.
Do you use and/or suggest a different one yourself?
I use VCE '10. It took me a while to get used to it but I will always recommend Code::Blocks to beginners since it's more friendly (I don't know if you're a beginner since you never said how much of C++ you knew 7 years ago (or around that period)).
OK, HisServant77. Try this:
1) Navigate to: Settings >> Compiler and Debugger...
2) At the top of the dialog box, under the dropdown list, resides a button which is labeled: Reset Defaults. Press this button.