Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Starting C++ and have a quick question about MS Studio (http://www.programmingforums.org/showthread.php?t=10107)

Zephirus May 31st, 2006 3:40 PM

Starting C++ and have a quick question about MS Studio
 
Im suing Visual Studio and currently im working thru a book C++ primer by stephen prata which is a good book so far.


I noticed something though in each of my console programs I am making. I have to have this


#include "Staffix.h" (Or something close, im not at my computer right now so forgive me)


I tried to remove it an program wont work. Odd, the book said nothing about this line and yet it is required. Hmmmm... enlighten me? I understand includes and <iostream> but I cant find what this line is for and why it is required.

Prm753 May 31st, 2006 3:45 PM

Did you mean: #include "Stdafx.h"?

I think that is a line that you must include with Visual Studio, but I am not sure why. You won't have to include it if you use a different compiler, like Dev-C++, which is a free, open-source compiler.

melbolt May 31st, 2006 3:46 PM

Quote:

Originally Posted by Zephirus
Im suing Visual Studio and currently im working thru a book C++ primer by stephen prata which is a good book so far.


I noticed something though in each of my console programs I am making. I have to have this


#include "Staffix.h" (Or something close, im not at my computer right now so forgive me)


I tried to remove it an program wont work. Odd, the book said nothing about this line and yet it is required. Hmmmm... enlighten me? I understand includes and <iostream> but I cant find what this line is for and why it is required.

stdafx.h

:

// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//



nice little link here with visualizations:
http://www.hydrairc.com/doxygen/stdafx_8h.html

Zephirus May 31st, 2006 3:47 PM

which complier would be best to use? I have visual studio but I mean if something out there is better, I want to learn from the best program...

Prm753 May 31st, 2006 3:48 PM

Search the forums, or use Dev-C++. There are about a million threads on "What is the best compiler", I'm sure that you could find an answer somewheres around here. :)

Narue May 31st, 2006 3:56 PM

>You won't have to include it if you use a different compiler
Translation: "I don't know how to use that compiler, so *you* shouldn't use it". ;) I mean, really. If you're going to plug Dev-C++ (not necessarily a bad thing), you could at least base your recommendation on facts rather than ignorance.

>which complier would be best to use?
It depends on your needs. Find the one you're most comfortable with. Common compilers that can be freely acquired are Visual C++ Express 2005, Dev-C++, Borland C++ 5.5, and GCC.

>Odd, the book said nothing about this line and yet it is required.
Your book probably doesn't focus on Visual C++. The problem is that you're using the silly default console program option when creating a project. You want an empty project, then you don't need to use stdafx.h.

Prm753 May 31st, 2006 4:01 PM

Quote:

Originally Posted by Narue
>You won't have to include it if you use a different compiler
Translation: "I don't know how to use that compiler, so *you* shouldn't use it". ;) I mean, really. If you're going to plug Dev-C++ (not necessarily a bad thing), you could at least base your recommendation on facts rather than ignorance.

Well, I didn't mean that, but perhaps I should have worded it a different way. The fact is is that you don't have to include that line in Dev-C++ to be able to compile a console program. For this guy, apparently, he does in VS. My apologies for the confusion.

Narue May 31st, 2006 4:06 PM

>The fact is is that you don't have to include that line in Dev-C++ to be able
>to compile a console program.
Well, I can't argue with you there. :rolleyes: But it's also a fact that you don't need to switch compilers to disable that requirement. It's actually a much simpler solution than downloading and installing Dev-C++, then learning the new interface and a whole new set of quirks.

>For this guy, apparently, he does in VS.
It's a compiler setting. When someone complains that the console window opens and closes too quickly in Dev-C++, do you recommend that they use a different compiler?

Prm753 May 31st, 2006 4:10 PM

Quote:

Originally Posted by Narue
>The fact is is that you don't have to include that line in Dev-C++ to be able
>to compile a console program.
Well, I can't argue with you there. :rolleyes: But it's also a fact that you don't need to switch compilers to disable that requirement. It's actually a much simpler solution than downloading and installing Dev-C++, then learning the new interface and a whole new set of quirks.

>For this guy, apparently, he does in VS.
It's a compiler setting. When someone complains that the console window opens and closes too quickly in Dev-C++, do you recommend that they use a different compiler?

I'm going to shut up now... :o

And yes, you are right. No, I would not recommend switching compilers just because your window opens and closes really fast. I have never used VS, so I will shut up now.

Zephirus May 31st, 2006 4:15 PM

No no, Im new to this whole thing. I have the "free" version of VS 2005. But if there is something better out there to use, please suggest it!

Eventually I hope to get my BA and then get a job doing this but this is step one. All suggestions are welcomed


All times are GMT -5. The time now is 8:06 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC