I can't paste the header file into the microsoft visual 2013 file

Hey,

in the book: programming principles and practice using c++ of Bjarne Stoustroup he uses the std_lib_faciltiies header-file to integrate several features and commands into the program , here is the source code of it: http://stroustrup.com/Programming/PPP2code/std_lib_facilities.h

To be able to use this header file I had to copy this code into a notepad and then copy the notepad-file into the project file among header files and rename it from .txt to .h

Now I have to copy the header file from the project into the microsoft visual 2013 file inside "documents". I tried it by marking the header file and copying it. But when I right click into an empty space inside the microsoft visual 2013 file the button "paste" is disabled. I also tried to pull the header file into the visual 2013 file by mouse but it also doesn't work.

what may be a possible solution?

I need to integrate this header file to simplify the use of the book.

Thanks



Last edited on
In the Solution Explorer in Visual Studio, right-click on the project (or the filter) that you want to contain the file, and select "Add" and then "Existing Item".
In the Solution Explorer in Visual Studio, right-click on the project (or the filter) that you want to contain the file, and select "Add" and then "Existing Item".


I tried it but when I click on "Add "--> "existing item" I can't find the std_lib_facilities.h file so that I cannot choose it. I only find a usual file of my project called "hello world" (in which I also can't find it in) and hello world.sdf and one called hello world.sln

And are you sure that the file appears in the visual studio 2013 file inside "documents" then?

thank you
Last edited on
The file will be in whichever directory you chose to save it into in Notepad.

When you select "Existing Item" in VS, it will display a file selection dialog. You can use that to navigate to the directory where you saved the file - although it would be sensible to move the header file to the same directory as the rest of your code.
Be aware that when you click Add->Existing Item for a C++ project, VS will display only existing .h and .cpp files by default.

If you saved the file as .txt, after clicking Add->Existing Item, go to the File Name box at the bottom and enter *.*. That will show you all files in your project directory. You should then see your .txt file. Right click on your .txt file, and rename it to a .h file. Then select it.
I still cannot put the header file into my visual studio 2013 file.

look what I mean, here are some screenshots of the tutorial of Bjarne Stoustroup:

http://puu.sh/qfQv8/b998cea581.jpg

after he pastes it:

http://puu.sh/qfQwL/64cdf0da00.jpg

this is what doesn't work with my header file. I can't paste it in like he did. and if I put it inside the solution items like you said , I can't find it in the microsoft visual 2013 file either.
I can't click on the "paste in" button, when I want to copy the header file into the mc visual 2013 file


Do you know what the cause is?

thanks
Last edited on
I can't tell from a couple of screenshots what Stroustroup's book wants you to do. What's wrong with the instructions AA and I have given you?
You do not need to copy the header file to the compiler headers. Just make sure the the header in question (std_lib_facilities.h like any other header too) can be found by the compiler.
Topic archived. No new replies allowed.