Why do the c++ files in my folder not show when I try to open them in Visual Studios? - c++

I am trying to open up a pre-existing folder in visual studios that has several c++ files. When I look at them on my desktop it shows the files as there, but when I go to open them in visual studios they no longer show up in the folder. I am using a virtual PC and this folder is one I opened from a zip file if those factors make a difference.
Folder outside of VS:
vs. Folder inside VS:

Normally adding a project requires a folder to contain the .sln file. If you don't have a .sln file, you have to create a C++ project. We could open the project by selecting the .sln file to be added in Open>Project/Solution, just like the picture I uploaded.

Related

How do I automatically include folders and files to the deployment project in visual studio?

I have a c++ project in visual studio and a folder called assets, in the same location as the source file, that contains folders for music, sound effects and images that my c++ game uses. That folder must be placed in the same folder as the .exe file of the game.
I have created a deployment project for the c++ project. However, it seems like I need to manually add these folders (assets, images, music, etc.) and files to the File System on Target Machine.
Is there a way for visual studio to add these folders and files automatically?
I have not managed to find anyting online for how to do that so far.
Thanks.
This link provides many methods. You could drag all the files you want to add into the file system view. Or you could right click on the folder in explorer and click copy and then right click the folder in the file system view in the setup project and click paste.

Visual Studio 2015 Project Templates (C++) won't create project file in specific location

I'm trying to find how to create my own VC++ project template with all parameters set up for future development. But suddenly I appeared to stuck at a little problem: VS2015 won't create given structure inside of the project folder.
That's how my directory looks like inside of .zip file used for templating inside of Visual Studio:
Project/%ProjectName%.vcxproj
Project/%ProjectName%.vcxproj.filters
Project/%ProjectName%.vcxproj.user
Src/Main.cpp
MyTemplate.vstemplate
To be precise, it won't place .vcxproj file into the
%created_project_folder%/Project
directory, but directly into
%created_project_folder%/
directory instead, ruining file dependencies specified inside of project file. E.g. "include ../Src/Main.cpp" won't work because it will seek for file in wrong location.
I attached link to my .zip file below.
https://fex.net/#!654242360762
You can try to copy that onto #user#\Documents\Visual Studio XXXX\Templates\ProjectTemplates folder and then create project in VS. Project file will be created on the root instead of custom location.

C++ File - MS Visual Studio

I am making a C++ program that writes data to a file.
I am using MS Visual Studio Express 2012 for Windows Desktop,and my sources and .exe file are in different folders.
So,I need to create two files - one in sources folder and one in .exe-s folder.
But then,if I run my program using compiler,it will write data to the file in sources folder,and if I run .exe file,it will write to it's folder.
But I want all the data to be stored in the same file.
Sorry for bad explanation...
Please help!
Thanks.
You can change working directory in Project properties -> Debugging -> Working directory. Set it to $(TargetDir) (it's a macro for Output Directory which can be set up at General).
This way, when you starting program in VS, all relative paths will begin in binary's directory (instead of project directory, as it was with $(ProjectDir)).

Build a visual studio project on a subset of files in a directory

I would like to port my application from Linux to Windows. I'm trying to use visual studio to configure a project to build the Window application. The problem for me is that I only need a subset of files out my directory for Windows. But I would like to keep the integrity of the directory so that I don't need to checkout a subset of file to Windows. Does visual studio need the entire directory to be window files? For those who understand Window application development well, can you help me to understand:
Can I configure visual studio to build a project using a subset of the file from a directory?
If yes, how do I configure the project file? Any link to a tutorial would be really helpful.
Below are couple of quick suggestions using Visual Studio
Include/ Exclude :
If the number of file are minimum, then you could include or exclude files to a project manually.
You could add a directory to a project by copying the files to a folder under the .vcxproj(ur .<>proj) file.
Then select the project in the solution explorer and on the tool bar you would get an option Show All Files
Right click on the Folder or File and hit Include In Project. This will include the file/folder into your project.
You could Exclude any file that is already included in your project by, clicking the file and hit Exclude From Project.
Remove From Compilation Only:
Select the file in Solution Explorer and right click Properties
Under Configuration Properties -> General -> Excluded From Build set it to Yes/No

Add folders in a visual c++ project

How can I add whole folder and its subdirectories in a visual c++ project? I am using visual studio 2010 professional. I mean you can add files by using Add Existing Item but how do you add a whole directory?
The quickest way that I know of is to
add the folder to your project file directory using Windows Explorer
find the folder in Solution Explorer (make sure Show All Files is checked)
right click on the folder and select Include In Project
You may have to do the folder and the files separately, but you can select multiple files at once.