How to handle the Specification and Implementation files to be used in C++?

  • C/C++
  • Thread starter yungman
  • Start date
  • Tags
    files
In summary: Rectangle r = Rectangle:: Rectangle(); cout << r.getW() << endl;cout << r.getL() << endl;cout << r.getA() << endl;
  • #36
I copied what you posted in post #6, with one small change (eliminated the long path on the header file), and the program worked as expected. No muss, no fuss, no gyrations.

Of course the portion with main() has to have an #include for the header file -- the header file contains declarations for the class and its methods that you are using. And of course, the implementation file needs an #include for the header file, since the implementation is providing definitions for the class methods.
In both the user of the class (with main()) and the implementation, this is all you need as declarations for the class and its methods (functions):
C++:
#include "Rectangle.h"
You really don't want that long full path you had in post #6.
 
  • Like
Likes yungman
Technology news on Phys.org
  • #37
yungman said:
In my book, VS have issues. I might be new in programming, I use a lot, I mean a lot of programs like circuit simulations, microwave simulation, OrCad, PADS and other pcb layout programs.
These are all applications, and are very different from a program or suite of programs that are used to create an application.
yungman said:
I never encounter so much inconsistent issues like VS.
I'm inclined to agree with @Jarvis323 here.
Jarvis323 said:
Every inconsistency or issue you have run into so far has been your own inconsistency or issue, NOT a problem with the software you're using.
 
  • Like
Likes Vanadium 50
  • #38
Mark44 said:
I copied what you posted in post #6, with one small change (eliminated the long path on the header file), and the program worked as expected. No muss, no fuss, no gyrations.

Of course the portion with main() has to have an #include for the header file -- the header file contains declarations for the class and its methods that you are using. And of course, the implementation file needs an #include for the header file, since the implementation is providing definitions for the class methods.
In both the user of the class (with main()) and the implementation, this is all you need as declarations for the class and its methods (functions):
C++:
#include "Rectangle.h"
You really don't want that long full path you had in post #6.
Thanks for your reply

I tried. Now I do something funky, just follow what I did.
1) I created a new project and called Temp. I right click the Header file --> ADD --> NEW Item --> Header file which I named Temp.h. I then copy the header file from post 6 in.
2) I then right click the Source File --> ADD --> NEW Item --> C++. I called Temp.cpp. I copied the .cpp file from post 6 in. I then closed the Temp project.

3) I went into the folder of Temp project and copy both Temp.h and Temp.cpp into a new folder somewhere else. AND I DELETED the whole Temp project folder.

4) I then create a new empty project T1. I added the both Temp.h and Temp.cpp. like you described by ADD-->Exist file and search and add both of them. Making sure Temp.cpp has #include "Temp.h".

5) Then I right click Source File--> ADD --> New Item --> C++, I copied the Source file from post 6 in. I change to #include "Temp.h".

I ran and it failed.

Here is the snap shot of the Source.cpp that shows red wiggled line under #include "Temp.h".
Compile error Listing 7.2.jpg


Then I ran Ctrl-F5. This is the error message.
Compile error Listing 7.3.jpg


I circled on the right side that I have Temp.h in it.I double checked all 3 files and they look right.

I did these steps because as I described in post #33. There is always some strange things going on.
To verify this.

1)I DELETED T1.

2) Create a new project T2.

3) In T2, I ADD the Temp.h, Temp.cpp and Source.pp STRAIGHT from the folder I saved them in( the same as before). I make sure Source.cpp has #include "Temp.h".

4) Ran it, it works like a Champ.
You see what I did different between the two? If I copied everything into one project straight from the folder, it works. BUT, if I create a DIFFERENT project(T1) and ADD the Temp.h and Temp.cpp, then I copy the same Source.cpp in, it doesn't recognize the Temp.h.

I know this issue for a few days already, I just never bother to ask as I have asked too many questions here already. Again, thanks for your patience in keep helping me.

Thanks
 
Last edited:
  • #39
I did more-or-less what you described in post #38, and again, it worked just as it should.
The only thing I can see is that possibly the program structure as shown in VS doesn't match the actual file structure on the hard drive. You copied several files, but if you copied them to the wrong directory, VS is not going to be able to find them.

I created a new project named Temp. I then deleted the file that was in there, a nearly empty file named Temp.cpp. I copied Rectangle.h, Rectangle.cpp, and RectImpl.cpp as shown in the following screen shot of Solution Explorer in VS.
SolnExpl.png


Here is a screen shot of the file structure, as shown in Windows Explorer.
FileExpl.png

The file structure should look like this:
Temp directory
... Temp.sln
... Debug directory (after a successful build, assuming your are in Debug mode). It should contain ....Temp.exe and a couple of other files used by the debugger.
... Temp directory (an inner directory with the same name as the outermost directory
... Two source code files - Rectangle.cpp and RectImpl.cpp, and the header file Rectangle.h
... Two or three files that VS uses - Temp.vcxproj, Temp.vcxproj.filters

I suspect that all your copying and deleting of files screwed things up so that VS can't find the files it needs to build the program.

Open Windows Explorer and see what your file structure looks like. If it doesn't look like what I've shown here, that's what's causing the error you see.
 
  • #40
Hi Mark
I created a Test folder that I stored the Temp.h, Temp.cpp and source.cpp from a WORKING program.

The difference is in the Temp project, I right click the Header files and ADD existing files and go to Test folder to get the Temp.h. Then I right click the Source file and ADD existing files and go to Test folder and get Temp.cpp.

THEN I open a NEW project T1, take in the source.cpp from the Test folder . I COPY to code of the source.cpp. I then go back to Temp project, ADD NEW file called source.cpp as the main file. Then I PASTE the code I copied from T1 in. It failed. It's the same code. Here are the 3 screen to show you the code of all 3 files.
TempSource.cpp.jpg

Notice the red wiggle line?
This is the Temp.cpp the implementation file.
TempTemp.cpp.jpg
This is the Temp.h the Specification file
TempTemp.h.jpg
Now, this project is called Project2. I use ADD--> Existing file and go to Test folder to get ALL 3 files. It work like a champ. Mind you, in both Project2 and Temp above, the codes are EXACTLY THE SAME. Here are the screen shots of the 3 Project2 files. You can be the judge to compare the codes to verify:

Proj2 source.cpp.jpg


Proj2 Temp.cpp.jpg


Proj2 Temp.h.jpg
 
  • #41
Let me sum it up my experience. In order for the program to work, ALL 3 files has to be created the same way. Like in project2, I use ADD existing file and go to Test folder to get all 3 files.

In Temp project that failed. I use ADD existing file and go to Test folder to get only Temp.h and Temp.cpp. THEN in order to make the source.cpp coming from a different place. I created a new project T1 just to get the source.cpp into the project, THEN just use Ctrl-C to copy the code. Then I go back to Temp, ADD--> New-->.cpp to create a blank source.cpp. Then I Ctrl-V and copy the code into it. It failed.Like I said, this is not new to me, a few days ago I did 3 exercise, first exercise is to create 5 structures with data in each of them. The second exercise is to read the 5 back. They are work. The 3rd exercise is to read the 5, choose to change one of them. IT FAILED. Even if I copy the binary file from the first exercise to the folder of the 3rd exercise, it FAILED.

I finally had to just copy and paste the code from the first exercise into the 3rd exercise, run the code to create the 5 structures store in the folder of the 3rd exercise. Then delete the code. Now I can read and change anyone of 5 as will.

This is NOT new to me. that's why I know how to make it fail. All I have to do is to have the source.cpp created from a different source from the Specification and Implementation files, it will fail.

Different source is just copy into another project first, then copy over. Just that simple.

thanks
 
  • #42
If you #include "x.h" in a source file, then either x.h needs to be in the same directory as that source file, or you need to tell the compiler where to look for header files by adding to the list of include search paths.

It makes sense that you would have the error if the source file is in one place and the headers are in another, and visual studio is not generating the compiler arguments to add the location of the headers to the search path. You can manually add those directories to the search path as I pointed out in previous posts. You can look at the actual compiler command and see if the include search path was added.

https://stackoverflow.com/questions...-the-build-command-line-used-by-visual-studio

You would think "add existing file" might automatically trigger VS adding a new include directory to the search path if necessary.

Maybe some of the answers here will help as well. I noticed the last one suggests individual cpp files might have their own properties (e.g. additional include directories) separate from the project properties. Or maybe you added the file only for release or debug mode instead of for all configurations.

https://stackoverflow.com/questions/3790632/visual-studio-does-not-honor-include-directories

Or Mark mentioned something about setting up a "common" directory. I don't know the way people are supposed to handle this in VS exactly.

Also, don't mistake the folders in VS for real folders. The files have an actual location on your computer, which is what actually matters.
 
Last edited:
  • #43
Hi Jarvis, Thanks for the reply. It's late to go over your long post tonight, I'll read into it tomorrow.

Regarding to where to put the .h and .cpp files, there is nothing wrong where I put it. You can see from the 6 screen captures in post 40, they are all there and show exactly where the files are. All the codes are in the exact right place as shown and all the codes are identical between the working Project2 and the non working Temp.

It is very repeatable also, Like earlier on, I replied in post #38, I created the file that failed and post in #38. I then deleted all of them. When Mark responded, I had to create both files, one working and one failed. I can just create them one time through. It's that predictable.

Of cause, It can still be me making the same mistake over and over. That's why I showed in post #40 exactly the two program, every piece of code and show where those files are. They are identical.

Thanks
 
  • #44
yungman said:
Hi Jarvis, Thanks for the reply. It's late to go over your long post tonight, I'll read into it tomorrow.

Regarding to where to put the .h and .cpp files, there is nothing wrong where I put it. You can see from the 6 screen captures in post 40, they are all there and show exactly where the files are. All the codes are in the exact right place as shown and all the codes are identical between the working Project2 and the non working Temp.

It is very repeatable also, Like earlier on, I replied in post #38, I created the file that failed and post in #38. I then deleted all of them. When Mark responded, I had to create both files, one working and one failed. I can just create them one time through. It's that predictable.

Thanks
Yeah, but the key is that VS is not showing you where the files actually are. Those aren't real folders. Add existing file doesn't move any files.
 
  • Informative
Likes pbuk
  • #45
yungman said:
Regarding to where to put the .h and .cpp files, there is nothing wrong where I put it. You can see from the 6 screen captures in post 40, they are all there and show exactly where the files are. All the codes are in the exact right place as shown and all the codes are identical between the working Project2 and the non working Temp.
None of the screen shots you posted shows the actual file structure. That's why one of the screen shots I posted was from Windows Explorer, not VS.
yungman said:
Of cause, It can still be me making the same mistake over and over. That's why I showed in post #40 exactly the two program, every piece of code and show where those files are. They are identical.
No, your screen shots did not show where those files are. In post #39, at the bottom, I wrote this, which you apparently didn't read. Many of the problems that you have encountered were due to not reading what others wrote.

Mark44 said:
Open Windows Explorer and see what your file structure looks like. If it doesn't look like what I've shown here, that's what's causing the error you see.
Please reread what I wrote in post #39. Below, @Jarvis323 is saying the same thing that I said in post #39.

Jarvis323 said:
Yeah, but the key is that VS is not showing you where the files actually are. Those aren't real folders. Add existing file doesn't move any files.
 
Last edited:
  • Like
Likes Vanadium 50
  • #46
I think that something @Jarvis323 is key to your (@yungman's) difficulties.
Jarvis323 said:
You must have made a mistake. I would go back and try again, try to see what strange thing you did to mess it up.
If you (@yungman) find that a poster's advice isn't working for you, go back and re-read the post with the advice. This has happened enough times that it bears repeating. Although it's possible that the advice is wrong (we're all human), I would venture to say that there's probably about 5% chance that the advice is in error, and 95% chance that you didn't read all of the advice or follow it correctly.
 
  • Like
Likes Vanadium 50
  • #47
Hi Mark

I don't mean to be offensive. I know what you mean about looking at the file explorer. I am going to post the screen shot of both the Project2(working) and Temp(not working) later.

I don't think you read my description carefully enough. My whole point is if the source.cpp are from different places where the Temp.h and Temp.cpp come from, it won't work even if you read them, they are IDENTICAL.

I describe in detail TWICE already, first in post 38, then again in post 40 and 41, in very detail how I created the two project. I show you in post 40 that on the right side, you see all 3 files there. AND if you click anyone of them, you can SEE the codes of EACH of them. They are there. I screen shot all 3 codes in both Project2 and Temp, you can see they show EXACTLY the same. One work and one doesn't Please look at them again. How can this go so wrong if I went through all these to show they are there?Regarding to what you ask. I looked and NONE of them have the Temp.h and Temp.cpp. The working one Project2 don't even have source.cpp. They are so far off I did not even mention it. Here are the screen shot, both are wrong according to you, I have no explanation why Project2 work.

Here is the Temp that DOESN'T work:
Temp file explorer.jpg

Here is the Project2 that WORKS.
Proj2 file explorer.jpg
You see the Project2 doesn't even have a single file? BUT IT RUNS.

I am open to be wrong (as usual), I put in a lot of time on this, why don't they contain those files? Why can't I do ADD--> Existing file and go to the folder to get the file. Project2 was done by that, it works, it ran but still don't show any of the .cpp and .h in the file explorer?

Thanks
 
Last edited:
  • #48
I went back and look at the old folders, those I created as described in post #30 all have source.cpp, Rectangle.h and Rectangle.cpp in the file explorer. I redo a new project, BUT instead of ADD--> Existing and load the file. I COPIED those codes, using ADD-->New and paste them in. It works and in file explorer, it shows all 3 files like you want to see.

WHY? Why it won't show if I do ADD-->Existing and navigate to another folder to get the file? Why it has to be copy and paste? the method I used in post 30 all needs to be copy into the newly created blank files. Both ways, you can see the files are there, you can click and see their codes. Why?
 
  • #49
yungman said:
I went back and look at the old folders, those I created as described in post #30 all have source.cpp, Rectangle.h and Rectangle.cpp in the file explorer. I redo a new project, BUT instead of ADD--> Existing and load the file. I COPIED that codes, using ADD-->New and paste them in. It works and in file explorer, it shows all 3 files like you want to see.

WHY? Why it won't show if I do ADD-->Existing and navigate to another folder to get the file? Why it has to be copy and paste? the method I used in post 30 all needs to be copy into the newly created blank files.
We answered this question in detail multiple times already.
 
  • #50
Jarvis323 said:
We answered this question in detail multiple times already.
Why it run nicely with Project2 if it is all wrong?
 
  • #51
yungman said:
Why it run nicely with Project2 if it is all wrong?
Did you find the "additional include directories" property for your project, and for your source files individually?
 
  • #52
Before I start digging into the file stuffs. I ran more experiments based on looking at the file explorer and to find out why the files don't show up when Project2 works.

This is what I did. With Project 2 that I use ADD-->Existing file to go to Test folder to get those files. I went to Test folder and temporary deleted the Temp.h. Project2 FAILED to compile. This means the Project2 NEVER pull in the files, just by reference(if that's the right word). That might be the reason why it doesn't show up in file explorer.

If I do copy then ADD-->New, You will see all 3 files in the file explorer like what Mark show.

So the result is, either I do all ADD-->Existing for all 3 files, OR ADD-->New and copy the codes for all 3 files. They BOTH WORK. BUT if I mix some ADD-->Existing, some ADD-->New and copy, it FAIL.

Why?

This go beyond digging through the files and all. VS obviously gives the provision of ADD-->New and ADD-->Existing. How come there is limitation? Checking into the files ONLY shows the result/symptom, WHY ADD NEW and ADD Existing cannot be combined? This is more troubling to me.

Now, I am going to look into what Jarvis said. I still don't believe they are the same.
 
Last edited:
  • #53
yungman said:
Why?
How many times will you keep asking why and ignore the answer?

Because the source file needs to be in the same directory as the include file, or the "additional include directories" of the source file needs to have the directory where the header files added.

This is the last time I'll respond to any of your posts. Good luck.
 
  • Like
Likes Vanadium 50
  • #54
yungman said:
WHY? Why it won't show if I do ADD-->Existing and navigate to another folder to get the file?
Add --> Existing item... doesn't copy files to the directories for the project you're working on. The file is added to the project and will be shown in the VS Project Explorer, but the file will still be in whatever directory it already was in.

What you should be doing is Add --> New item... This creates a blank file with the name you choose, and puts it in the right directory. Then you can copy the text from the old file, and paste it into the file you've created.
 
  • #55
Mark44 said:
Add --> Existing item... doesn't copy files to the directories for the project you're working on. The file is added to the project and will be shown in the VS Project Explorer, but the file will still be in whatever directory it already was in.

What you should be doing is Add --> New item... This creates a blank file with the name you choose, and puts it in the right directory. Then you can copy the text from the old file, and paste it into the file you've created.

Thanks for the answer

I know that. At this point this is NOT my question anymore as I posted in post #52.

My question is if it is so important to have the file physically inside the project( to show in file explorer). Why then Project2 run just fine using ALL Add-->Existing?

Why then the exact same code FAILED if I mix Add-->Existing with Add-->New? It has to be either ALL Add-->Existing OR Add-->New?I have been searching in VS, I found Exporting Template so others can use it. Is that the right way in the future to link Class Object to be used in the program? I've been trying to use Add--> Existing thinking that it's better to link external files from another folder.
Thanks
 
Last edited:
  • #56
Jarvis323 said:
How many times will you keep asking why and ignore the answer?

Because the source file needs to be in the same directory as the include file, or the "additional include directories" of the source file needs to have the directory where the header files added.

This is the last time I'll respond to any of your posts. Good luck.
I am not ignoring your answers, I actually looked back to your posts. I understand you and Mark said I need to have all 3 files inside the project using file explorer as Mark said in post #39. If I do Add-->New and copy all the files in. This, I can see in file explorer all 3 files are there.

My questions are why Project2 works without any of the files in the project folder then? I use Add-->Existing that doesn't actually pull the files in.

AND the most important question is why then if I MIX Add-->Existing and Add-->New, it fail no matter what?

I hope you can reconsider, you have been very helpful and I cannot thank you enough.

Thanks
 
Last edited:
  • #57
Hi Jarvis

You posted a video and I notice you deleted the post. I was watching the video, there's nothing similar to the video with my VS. I even tried starting with Console App or Window Desktop Wizard, they are nowhere the same as in the video. I cannot follow it. VS 2019 make it very automatic. I know how to add in the .h and .cpp file no problem at all. That's not in question.

Thanks anyway.
 
  • #58
yungman said:
Hi Jarvis

You posted a video and I notice you deleted the post. I was watching the video, there's nothing similar to the video with my VS. I even tried starting with Console App or Window Desktop Wizard, they are nowhere the same as in the video. I cannot follow it. VS 2019 make it very automatic. I know how to add in the .h and .cpp file no problem at all. That's not in question.

Thanks anyway.
I guess you misread all of my responses.

When you "add existing" to all three files, all three files are in the same directory (not in the project directory, but the cpp is in the directory that the h is in). That's why it works.

I posted the video because it shows how to put header files in a separate place as a cpp file. VS 2019 might have a different GUI, but it works the same way. You just need to figure out where the "additional include directories" setting is. I bet it would take 5 minutes to find it if you actually looked for it.

Until you figure that out, you're just wasting your time. It's like you keep walking into a closed door because you refuse to listen when someone tells you how to open it.

I deleted the video because, although it shows how to organize h and cpp files separately, the author added the path to his "src" folder in the "additional include directories", which I think doesn't make sense and could lead to confusion about how things actually work.

VS apparently allows you to set different "additional include directories" for each cpp file. This makes sense, because you might have different header files in different places with the same name, and need to control which one is included by which cpp file. VS designers had to make a choice what the default behavior is in different cases. I guess the way you are using it, the default is to NOT add the path to the header file in the "additional include directories" property of the cpp file. So you have to do that manually, or you have to figure out how to change the VS default, or do things a different way so that the default is what you wanted.
 
Last edited:
  • Like
Likes yungman
  • #59
Jarvis323 said:
I guess you misread all of my responses.

When you "add existing" to all three files, all three files are in the same directory (not in the project directory, but the cpp is in the directory that the h is in). That's why it works.

I posted the video because it shows how to put header files in a separate place as a cpp file. VS 2019 might have a different GUI, but it works the same way. You just need to figure out where the "additional include directories" setting is. I bet it would take 5 minutes to find it if you actually looked for it.

Until you figure that out, you're just wasting your time. It's like you keep walking into a closed door because you refuse to listen when someone tells you how to open it.

I deleted the video because, although it shows how to organize h and cpp files separately, the author added the path to his "src" folder in the "additional include directories", which I think doesn't make sense and could lead to confusion about how things actually work.

VS apparently allows you to set different "additional include directories" for each cpp file. This makes sense, because you might have different header files in different places with the same name, and need to control which one is included by which cpp file. VS designers had to make a choice what the default behavior is in different cases. I guess the way you are using it, the default is to NOT add the path to the header file in the "additional include directories" property of the cpp file. So you have to do that manually, or you have to figure out how to change the VS default, or do things a different way so that the default is what you wanted.
After a search, I found that the "additional include directories" option is in the C++ General tab for VS 2019.
https://docs.microsoft.com/en-us/cpp/linux/prop-pages/general-linux?view=vs-2019
 
  • Like
Likes yungman
  • #60
yungman said:
My questions are why Project2 works without any of the files in the project folder then? I use Add-->Existing that doesn't actually pull the files in.
For a project named Temp, VS keeps track of where all the files are in a file named Temp.vcxproj. This is a text file, so you can read it. It's not a good idea for you to edit it, if you don't know what you're doing. You can find the .vcxproj file for your project in the 2nd-level directory for your project, which will normally have the same name as the top-level directory.
yungman said:
AND the most important question is why then if I MIX Add-->Existing and Add-->New, it fail no matter what?
I don't know. This is not enough information to go on. I've described a way that works, so why are you exploring weird ways that you know don't work.
yungman said:
My question is if it is so important to have the file physically inside the project( to show in file explorer).
It's not important, other than to keep different projects separate from each other. The files that make up a multi-file project can be pretty much anywhere, as long as there is information about their locations in <project_name>.vcxproj, but that's not a good way to organize things.
All of your programs have been built from single projects. More complex programs can be made up of multiple projects. At the top level in Solution Explorer is the Solution, which is named Temp in your case. This solution could be made up of two or more projects, each with its own Header Files section and Source Files section, as well as its own References, External Dependencies, and Resource Files sections.
yungman said:
Why then Project2 run just fine using ALL Add-->Existing?
The project won't build if you don't save all the files -- so that the .vcxproj file gets updated. If it gets updated, then things should work just fine, but if you build before this file is updated, then you're get compile errors. That's all I can think of.
The only time I use Add -> Existing item... is when I have already copied the file into the appropriate directory, as viewed in Windows Explorer. Then I use Add --> Existing item...
 
  • Like
Likes yungman
  • #61
I printed out the response, I need to take time to read it. I'll be back.

thanks
 
  • #62
Mark44 said:
For a project named Temp, VS keeps track of where all the files are in a file named Temp.vcxproj. This is a text file, so you can read it. It's not a good idea for you to edit it, if you don't know what you're doing. You can find the .vcxproj file for your project in the 2nd-level directory for your project, which will normally have the same name as the top-level directory.
.....
Do you mean Temp.vcxproj.filter? I use notepad to open this file and these are the 3,

First one is with all 3 files physically in the project. You can see all three at the bottom.
vcxproj.filter with files in project.jpg

This one with Add-->Existence. You can see it shows the path to the files
vcxproj.filter without files in project.jpg

Finally the one with only the source.cpp physically in the project folder
vcxproj.filter one files in project.jpg

Is this what you are referring to, that I should check this to know where the files are? regarding to you said you don't have enough info to comment on the Temp project that doesn't work with mixed Add-->New and Add-->Existing. The 3rd print out is the file. You can see where the 3 files came from, see whether you can make some heads and tails out of it.

I am still reading through the responses.

Thanks
 
  • #63
Screenshot (50).png

Screenshot (51).png
 
  • Like
Likes yungman
  • #64
Jarvis323 said:
Hi Jarvis

Thanks for still helping me, I really appreciate this. I follow you and get to this point but I really don't follow what am I supposed to do with it next.

Jarvis323 said:
After a search, I found that the "additional include directories" option is in the C++ General tab for VS 2019.
https://docs.microsoft.com/en-us/cpp/linux/prop-pages/general-linux?view=vs-2019

I really don't follow what's going on here. what do you want me to learn from this? I am really lost.

Thanks
 
  • #65
yungman said:
Do you mean Temp.vcxproj.filter?
No, I mean just exactly what I said -- <project_name>.vcxproj. In this case, it would be Temp.vcxproj.
 
  • #66
Hi Guys

I really don't follow what's going on here. I thought in Solution Explorer, there is Header files that I add in the .h files and Source files that I add in the .cpp files. Maybe at this time, I should just accept that I can only do Add-->New to either the Header files and Source files in the Solution explorer, then I can move on. Any other things I need to watch out?

Thanks everyone for the time.
 
  • #68
Mark44 said:
No, I mean just exactly what I said -- <project_name>.vcxproj. In this case, it would be Temp.vcxproj.
I tried that, this is what I got:
Nothing like you described.

Thanks
 

Attachments

  • Temp_vcxproj.txt
    222 bytes · Views: 111
  • #69
yungman said:
Hi Jarvis

Thanks for still helping me, I really appreciate this. I follow you and get to this point but I really don't follow what am I supposed to do with it next.
I really don't follow what's going on here. what do you want me to learn from this? I am really lost.

Thanks
You just add the path of your header files in that box that I pointed out. Then when the compiler compiles your program, it will look for header files in those directories that you've listed in the box. That is the solution to your problem. Then you won't get the error that the header file wasn't found, and no matter how you added the files to the project, it will work. I went over what is going on multiple times already in previous posts, but I guess there is a communication barrier we can't get through.

I recommend to just keep it as simple as possible and follow Mark's advice on how to get something working. If you want to figure out how to put files somewhere else besides the project directory, or figure out what was wrong with what you've done, you can always come back to and re-read the thread.
 
  • Like
Likes yungman
  • #70
Jarvis323 said:
You just add the path of your header files in that box that I pointed out. Then when the compiler compiles your program, it will look for header files in those directories that you've listed in the box. That is the solution to your problem. Then you won't get the error that the header file wasn't found, and no matter how you added the files to the project, it will work. I went over what is going on multiple times already in previous posts, but I guess there is a communication barrier we can't get through.

I recommend to just keep it as simple as possible and follow Mark's advice on how to get something working. If you want to figure out how to put files somewhere else besides the project directory, or figure out what was wrong with what you've done, you can always come back to and re-read the thread.
You mean like this:
Add directory.jpg


I added it in and hit apply. I went back to Solution Explorer, I did not see that. There is no indication I added anything.

yes, I feel I am wasting you and Mark's time. I just stick with using Add-->New and copy or type in the codes and it will work for now. Again, thanks for taking the time to help me.

Thanks
 

Similar threads

  • Programming and Computer Science
Replies
2
Views
671
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
375
  • Programming and Computer Science
Replies
33
Views
2K
  • Programming and Computer Science
Replies
6
Views
918
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
8
Views
3K
  • Programming and Computer Science
Replies
2
Views
628
  • Programming and Computer Science
Replies
29
Views
2K
Back
Top