473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Preproccessors

Loismustdie129
195 100+
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
6 1625
Banfa
9,065 Expert Mod 8TB
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
macklin01
145 100+
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
7,435 Expert 4TB
Who would deprecate stdio.h?!
Dec 24 '06 #4
macklin01
145 100+
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
7,435 Expert 4TB
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
macklin01
145 100+
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

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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.