Build a visual studio project on a subset of files in a directory - c++

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

Related

I Don't Know How To Use/Run These Files That Are In A Github C++ Library I'm Trying To Add To My Project?

https://github.com/gladosconn/ecdsa_cxxI have been trying to get this library into my project (C++ using Visual Studio 2022, in Windows) because I need to use the ecdsa signature algorithm, I have copied all the files in src folder to a folder called "ecdsa" in the src folder inside my project, and I didn't do anything with the test folders (I think that I don't need them since they're just tests), but then there are these files (.ytml) ,(.txt) ,(.py), I have no idea what am I supposed to do with them or where to put them, but I sure I need them because the program isn't working, it's giving me this error Cannot open include file: 'secp256k1.h': No such file or directory Libraries.Also I have done everything in the requirements section, my compiler supports C++11, and I have installed openssl, and I have CMake installed.This is my first time using anything from Github so I'm sure what to do.
In Visual Studio, right-click on your project in the Solution Explorer pane. From the menu that pops up, choose the 'Properties' item. It is usually at the very bottom. A dialog box will appear.
In the left pane of the dialog box, expand the options Configuration Properties > C++ > General. Now, in the right pane of the dialog box, probably at or near the top will be an item labeled 'Additional Include Directories`. Add the full path to the folder where you copied the source files from GitHub.
You may need to explicitly add ALL the files you downloaded from GitHub into your Visual Studio project.
Try compiling again.

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.

Multiple file compilation in visual C++ 2010

I have a very specific question in regards to visual C++ 2010 express. I have looked everywhere but can't find instructions on how to compile several source files. I have programmed on Unix at the command line and am trying to learn visual C++ 2010. I am using a header file that contains the function declarations and global variables. I don't know if this is the correct venue to ask this question but if anyone knows of some place where I can get the answer I would be grateful
Thanks,
Ral
If you have a project that you build from the command line with a makefile, then the Visual Studio development environment will not recognize your project. To open and build your project using Visual Studio, first create an empty project containing the appropriate build settings using the Makefile Project Wizard. You can then use this project to build your project from the Visual Studio development environment.
The project displays no files in Solution Explorer. The project specifies the build settings, which are reflected in the project's property page.
The output file that you specify in the project has no effect on the name that the build script generates; it declares only an intention.
Source: Creating a Makefile Project (VS2013)
On the menu: File->New->Project
On the dialog:
select Win32 Console Application,
enter Name ( like you did in the -o in unix) in the bottom,
and press OK
On the next dialog: Press next.
On the next dialog:
unmark Precompiled headers
mark Empty project
press Finish
Now find the Solution Explorer tree. You have Solution name and a project with the same name in it.
Right click on the project (not solution)
choose Add->Existing Item
and select your files, (you can copy them to the opened folder and then choose them)
press Add
Now you can try to compile.

GStreamer C++ on Visual Studio 2010?

Following instructions on http://docs.gstreamer.com/display/GstSDK/Installing+on+Windows to install GStreamer and compile tutorials/examples on Windows 7, for compilation using Visual Studio 2010.
After installing the SDKs, I try to compile the "hello world" example...
Cannot open include file: 'gst/gst.h': No such file or directory.
Odd - the tutorials were supposedly configured with the paths to these files. Nevertheless, we can manually add them...
Add C:\gstreamer-sdk\0.10\x86\include\gstreamer-0.10 to project include directories
Cannot open include file: 'glib.h': No such file or directory
Add C:\gstreamer-sdk\0.10\x86\include\glib-2.0 to project include directories
Cannot open include file: 'glibconfig.h': No such file or directory
At this point it seems to be a dead-end, as there isn't a glibconfig.h file anywhere on PC.
Was some step missing from the gstreamer documents?
p.s. I see a similar question, but its accepted answer seems to be a dead-link.
This question was posted on 2014. However, for everyone that needs to install Gstreamer on Visual Studio , I am explaining how you configure your library on Windows.
First of you need to download the library from https://gstreamer.freedesktop.org/data/pkg/windows/
You need to download and install both installers for developers and non-developers.
For instance for 1.14 it is the now latest version,
gstreamer-1.0-devel-x86-1.14.1.msi
gstreamer-1.0-x86-1.14.1.msi
You will install and setup both of them in the same directory like C:\gstreamer. (I guess gstreamer automatically adds its /bin to the Path environment. If not just ask it.)
After that you will open your Visual Studio. Create your C++ project. Create your main.cpp file. Right click on your project and click properties.
We need to do 3 steps:
Include the necessary directory paths.
Define the where the .lib paths are.
Specify which .libs you want to use.
After clicking properties:
C/C++ -> Additional Include Directories -> define your include paths such as
C:\gstreamer\1.0\x86_64\lib\glib-2.0\include;C:\gstreamer\1.0\x86_64\include\gstreamer-1.0;C:\gstreamer\1.0\x86_64\include\glib-2.0\;C:\gstreamer\1.0\x86_64\include\glib-2.0\glib;%(AdditionalIncludeDirectories)
Linker -> General -> Adding Library Directories -> write your lib directory path such as
C:\gstreamer\1.0\x86_64\lib;%(AdditionalLibraryDirectories)
Linker -> Input -> Additional Dependencies -> Write your .lib files you want to use such as
gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
gobject-2.0.lib;glib-2.0.lib;gstreamer-1.0.lib are the ones we added, others are done by default.
That's all. You can just write in your main.cpp file
#include <gst/gst.h> and use your GStreamer Library
I think this will work for almost all libraries.
(1) Install Windows Driver Development Kit
(2) When creating new projects, use the "gstreamer" template in Visual Studio, rather than the "Windows application" template. Then it doesn't need anything changing in the include/linker settings to make #include <gst/gst.h> work properly.
The standard gstreamer installation on windows has a glibconfig.h located in: (assuming your gstreamer installation is in C:\gstreamer) C:\gstreamer\1.0\x86_64\lib\glib-2.0\include
The official way is using the "Property Sheet" feature of Visual Studio.
In Visual Studio, click View→Property Manager or View→Other Windows→Property Manager on the menu bar.
Click Property Manager tab near the Solution Explorer.
Right click your project name and choose Add Existing Property Sheet..., and navigate to %GSTREAMER_ROOT_X86%\share\vs\2010\libs and load gstreamer-1.0.props.
This will add Addittional Include Directories, Addittional Libraries Directories and Additional Dependencies to your Project Properties.
Build your project.
Sources:
Creating new projects manually:
https://gstreamer.freedesktop.org/documentation/installing/on-windows.html?gi-language=c#creating-new-projects-manually
Share or reuse Visual Studio project settings:
https://learn.microsoft.com/en-us/cpp/build/create-reusable-property-configurations

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.