How do I find the iostream header file in a Visual Studio C++ project? - c++

I was learning more about header guards in C++ from here. One of the paragraphs there said:
Even the standard library includes use header guards. If you were to
take a look at the iostream header file from Visual Studio, you would
see:
#ifndef _IOSTREAM_
#define _IOSTREAM_
// content here
#endif
I'm interested in finding the iostream header file to see this header guard myself and to learn more about how C++ directories are structured to find files like these. I had a working C++ project in Visual Studio 2015, and in the project directory I tried dir *iostream* /s in cmd, but I didn't find anything. How can I find the iostream header file in a Visual Studio 2015 project if it's accessible?

iostream is not part of your project. It's part of c++ standard library. How about searching your HDD for it?

Related

Visual Studio how to determine whether a file without a suffix is a C++ header file

I've written some header files without suffixes (like .hpp or something) for looks nice.
But it seems that Visual Studio only reacts to some of these header files, the others are not shown in the include complement and are not automatically highlighted when opened.
I would like to know how Visual Studio determines that a file without a suffix is a c++ header file in order to hack this mechanism?

Visual Studio 2012 Error: Cannot open source file

I have source code (header and source files)of a library. I need to include the source code in my existing project. For that purpose i have copied the entire library source code directory into visual studio project folder then i included that directory to VS by using include to project option. Fine.
There is a header file say "x.h" in the library source code directory which defines some macros, and there are some other header files say "y.h" and "z.h" which are using those macros defined in "x.h". But visual studio is not recognising those macros at all when i included those ("y.h" and "z.h") header files in my main class. Visual Studio generates the error "Cannot open this source file".
Actually "y.h" and "z.h" can not find macros defined in "x.h". How to solve this error?
Is there some kind of setting need in the project properties?
My second question is that how to include some programming files in my project correctly so that i can use that library functionality correctly? I have also Include the header directories in configuration properties > VC++ Diectories > Include Directories.
Third question is that is there a way in which i don't have to include the source code to my project? remember i don't have .lib file or .dll file of that library and i cannot compile that library also.
Have you add
#include <x.h>
or
#include "x.h"
Are library files in a sub-folder? if Yes try
#include ".\subfoldername\x.h"

C++ Including Visual Studio header files in Qt project. <xstring> include error

I have found a library to generate barcodes (libbarpp). I would like to use this library in my Qt project.
Doing a svn checkout of the source: http://libbarpp.googlecode.com/svn/trunk/ reveals a nice VS example in the src folder. I opened the project in VS and found the included header files. I have included these header files in my Qt project, however i encountered a problem when several of the files required a system header file
#include <xstring>
In VS i can see the this file is located in (on my system):
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring
However the files does not have any extension and i don't really know what to do with it.
Do i need to include something in my Qt project file in order to use this VS file?
I tried including
CONFIG += stl
to my Qt project file, but with no luck.
Any help or comments is greatly appreciated.
EDIT: I'm using Qt 5.2.1 with MinGW compiler
xstring is a Microsoft specific header that contains implementation of std::basic_string and some related specializations.
It shouldn't be included directly in the first place and unless the code you are talking about is using something implementation specific from that file you should be fine replacing it with just:
#include <string>

Creating a C++ visual studio project based on existing files

I've never worked with C++ or C. I'm trying to create a Visual studio project based on existing files which can be found here: example1.cpp together with the resources. As you can see this is example code of a book for OpenGl. I have opengl and glut present on my computer and they work ( tested it).
Based on the files mentioned above a created an empty C++ project in visual studio 2012 (i also have other versions installed if you can provide a solution in 2010 or so). I included the header files & the source file. Though I still get the following in my IDE:
with errors such as:
cannot open source file "Angle.h"
( Though the file is present in the project)
Can anyone tell me how I get these files to compile and run ?
Make sure that the file angel.h it's in the same path that the .cpp file.
Header files need to be in same directory with source files in order to use #include with quotes.
#include "header.h"
In other words Angel.h must be in same directory with example1.cpp.
However,you can add spesicific paths to your project from Project Settings>VC++ Directories and include header files which exists in those paths using
#include <header.h>

Using Windows header files within Netbeans 6.8

I'm trying to make an windows application within Netbeans.
When using Visual studio it is no problem to use files like tchar.h
I have receaved a basic file structure containing those and I'm trying to get them to work on Netbeans IDE but it seems that Netbeans won't allow using files from Visual Studio.
I have tried to add the tchar.h file and all other file it required (including some C++ core files) and commenting the errors written in those care files:
#error ERROR: Use of C runtime library internal header file.
But netbenas can't find the tchar.h file while being in same folder...
If you're using gcc you might consider using the unix style wide characters instead of the microsoft specific version. Look at wchar.h
http://en.wikipedia.org/wiki/Wchar.h