By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,435 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,435 IT Pros & Developers. It's quick & easy.

Preproccessors

Loismustdie129
100+
P: 195
I have been looking all over the internet and can't seem to find an answer anywhere. Anyway I have been reading C++ source code and have found that when I try some of the preproccessors like "#include <studio.h>" or some others that my compiler says no such directory exists.

My question is, where do I find these directories to use the source code.
Any help is welcomed and appreciated.
Dec 23 '06 #1
Share this Question
Share on Google+
6 Replies


Banfa
Expert Mod 5K+
P: 8,916
by studio.h did you mean stdio.h ?

stdio.h should exist on you computer in one of the subdirectories that exist in your compiler installation. You need to tell the compilerr to look in this directory for these files.

There are at least 3 ways of doing this

1. Put the path into your include statements, however this is very bad form
2. Set the compilers include directory, this is often done by setting the INCLUDE environment variable
3. Include the path on the command line via a switch, often /I.
Dec 24 '06 #2

100+
P: 145
by studio.h did you mean stdio.h ?

stdio.h should exist on you computer in one of the subdirectories that exist in your compiler installation. You need to tell the compilerr to look in this directory for these files.

There are at least 3 ways of doing this

1. Put the path into your include statements, however this is very bad form
2. Set the compilers include directory, this is often done by setting the INCLUDE environment variable
3. Include the path on the command line via a switch, often /I.
You might also want to try
Expand|Select|Wrap|Line Numbers
  1. #include <cstdio>
  2.  
(Some compilers may have deprecated the older "stdio.h".) -- Paul
Dec 24 '06 #3

drhowarddrfine
Expert 5K+
P: 7,435
Who would deprecate stdio.h?!
Dec 24 '06 #4

100+
P: 145
Who would deprecate stdio.h?!
Good point. :)

In file included from c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/c.4.2/backward/iostream.h:31,
from test.cpp:2:
c:/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes 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 include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated <iostream.h>. To disable this warning use -Wno-deprecated.
My memory was off on stdio (that won't generate the deprecation warning), but since there is a cstdio, it wouldn't be a bad idea to use that, as it appears to be more modern. (See the c++ standard for more information.) The behavior between cstdio and stdio.h may be different. See this, for instance:

160) The ".h" headers dump all their names into the global namespace, whereas the newer forms keep their names in namespace std. Therefore, the newer forms are the preferred forms for all uses except for C++ programs which are intended to be strictly compatible with C.
Thanks for the sanity check. ;) -- Paul
Dec 24 '06 #5

drhowarddrfine
Expert 5K+
P: 7,435
since there is a cstdio, it wouldn't be a bad idea to use that, as it appears to be more modern.
I believe that is for C++ and is just stdio.h wrapped in a namespace so it isn't "more modern". It's not part of the C standard so it can't even be used in C so it must be part of the C++ library. In any case, stdio.h is updated and used as frequently as anything else.
Dec 25 '06 #6

100+
P: 145
I believe that is for C++ and is just stdio.h wrapped in a namespace so it isn't "more modern". It's not part of the C standard so it can't even be used in C so it must be part of the C++ library. In any case, stdio.h is updated and used as frequently as anything else.
Ah, thanks for the info. (Feeling silly now.;)) Thanks -- Paul
Dec 25 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.