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...