Click to See Complete Forum and Search --> : C++ Compiler


Paul Jr
12-03-2003, 10:56 PM
I know this is a Web Developers forum, but you guys are just so nice and helpful, I had to ask this here. :)


I've decided to start learning C++, and I am in need of a compiler. So I was wondering if anyone here had any personal favorites, or knew of any particularly good ones?

I've never done any programming before, so any help provided would be very much appreciated.

fredmv
12-03-2003, 11:09 PM
I've only done very little work with C++ (when I say very little, I mean as in "Hello, World" little), and I think Bloodshed Dev-C++ (http://www.bloodshed.net/devcpp.html) is the best free one I've come accross so far. Good luck with everything.

Paul Jr
12-03-2003, 11:22 PM
Actually, I did download that. And I Googled "C++ Tutorials" and clicked on this one here. www.cprogramming.com (http://www.cprogramming.com/tutorials/lesson1.html). Well, I follwed the instructions to the letter, 'cept I changed the text of course. And then I Compiled the file.

I got a warning which said, "This file contains at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples including substituting the <X> header for the <X.h> for C++ includes, or <sstrea"

The program won't run either. All it does is just display the text I've typed in. The window in which the program is supposed to be display flashes up for a split second, then just disappears... Puzzling indeed.

Paul Jr
12-03-2003, 11:27 PM
Eh, sorry, got the link wrong up there.

www.cprogramming.com (http://www.cprogramming.com/tutorial/lesson1.html)

fredmv
12-03-2003, 11:31 PM
You need to add extra code for the window to stay open. You can either do that or run it from a command-line. If you want it to stay open after printing the text (or whatever else), add this to the top of your code:#include <conio.h>Then, right before the closing curleybrace of main, use this function:getch();

Paul Jr
12-04-2003, 12:27 AM
I read what you said, then I tried this.


#include <conio.h>
int main() {
cout<<"Hello, World!";
return 0;
getch();
}


I got an error: " 'cout' undeclared (first use this function)"
And my previous problem still occurrs...

Khalid Ali
12-04-2003, 06:11 AM
you will have to remember that C++ is a fairly low level proramming langugae,
it typically does not automatically does things for you,you will have to let it know what to do.
So in your case

you are using a function cout but no declaring it or defining it anywhere,, Since its a library function for spitting data out,you will need to import the library file which is

iostream.h

so add this

#include <iostream.h>
#include <conio.h>

Sux0rZh@jc0rz
12-04-2003, 07:24 AM
lol.. kinda offtopic but I love programming... possibilities are endless and it just really appeals to me. Even though I have never tried it, I will try to start learning it soon, once i have a little more experience with PHP, my main goal ATM.

Paul Jr
12-04-2003, 11:07 AM
Well, I still have the problem of the program not staying up... the window in which it should display just flickers up for a split second.


Now, I tired something like this:

#include <iostream.h>
#include <conio.h>
int main() {
int age;
cout<<"Your age here, please:";
cin>>age;
if(age<14) {
cout<<"You are younger than I am.";
}
else if(age==15) {
cout<<"You are my age!";
}
else {
cout<<"You are older than I am.";
}
return 0;
}

And the program runs, asking for my age. But as soon as I type in my age and hit ENTER, the program closes.

Paul Jr
12-04-2003, 11:44 AM
Well, in an attempt to gain any knowledge of C++, I Googled it, hoping to find every and any arcticle and .txt I could find.

I found this. (http://www.research.att.com/~bs/compilers.html)
I am having the same problem. The program closes as soon as the ENTER key is pressed.

For a Compiler I'm using Dev-C++.

CardboardHammer
12-04-2003, 12:40 PM
Slap this in right BEFORE the return statement:


cout << "\nPress enter to quit.";
getch();

AdamBrill
12-04-2003, 12:57 PM
Originally posted by CardboardHammer
Slap this in right BEFORE the return statement:


cout << "\nPress enter to quit.";
getch();
That didn't work for me, but try this:

cout << "\nPress any key to continue" << endl;
getche();

Those should go right before the return statement...

And my recommendation for a compiler is Visual C++ 6.0. The bottom line is it rocks and I've never seen anything that compares. ;) The down side is that it is not free...

Paul Jr
12-04-2003, 01:50 PM
Alright, thanks for your help, I'll see if that works.


Adam,
This Visual C++ 6.0, what's the price tag?

AdamBrill
12-04-2003, 03:17 PM
Well, the new version of the Visual Studio is actually the .NET edition, but I don't like that as much for just plain old C/C++ programming. The .NET edition is really nice, too, but I prefer the 6.0 for C/C++. If I'm using VB, then I definately use .NET. ;) As for the price, though, I think you can get the standard edition for just over $100 or so. If you buy it used, you might be able to get it for cheaper, I don't know...

One more thing is if I were you I would check if you can get the academic edition, since it is much cheaper. As long as your still a student, you should be able to get it. It's not the easiest thing to find on their site, though, so you'll have to look around. ;)

Paul Jr
12-04-2003, 05:22 PM
Hmmmm... aight, I'll take a look at it, thanks. :)


P.S., are home schoolers eligible for the academi edition?

Sux0rZh@jc0rz
12-04-2003, 06:29 PM
any form of education gives you the right to claim student discount.

Paul Jr
12-04-2003, 07:28 PM
Ah, thank you all for your help!

AdamBrill
12-04-2003, 08:22 PM
Originally posted by Sux0rZh@jc0rz
any form of education gives you the right to claim student discount. While you do qualify as a home schooler, any form of education does not give you the right to claim student discounts. I'm not sure if they are all the same, but here is a list of "students" that do not qualify for Microsoft academic pricing:

Non-accredited schools
Training centers
Non-United States residents or educational facilities
K-12 education students and their parents

You might question the last item in that list(like I did), but we called them and found out that they do allow home-schoolers to purchase this edition. I really have no idea what they have that last one on the list for, since I am a K-12 student, but since they said it was ok, I got it. ;)

Actually, since I bought mine, they added this section:

Home-School Programs
Defined as a home-schooling program which provides primary education to a student or students aged eighteen (18) or under and which is able to provide written proof that it either (i) belongs to a nationally-recognized home-schooling organization, or (ii) is expressly recognized by a local school district as an acceptable alternative to an accredited or state-recognized/approved educational institution.
which makes it quite clear that Home-Schoolers are allowed as long as they are under 18.