How to include a project to another project in visual studio 2012 - c++

In my visual c++ project i include some codes of other projects.I got confused about how to do next step.Should i add projects or reference project.

You can directly add another project to current solution.
From Visual studio -----> File->Add->Existing Project..

Related

Working with Visual Studio C++ project in Visual Studio Code

I have a C++ project in Visual Studio and I much prefer Visual Studio Code for editing source files.
Is there a way to work with Visual Studio C++ projects in Visual Studio Code? Like getting include paths from ".sln" file or maybe even running MSBuild.
Open Developer Command Prompt/PowerShell for VS 2019. This will set necessary environment variables such as include paths.
Navigate to the directory of your project.
Type code . to start VS Code in your current directory.
Now, you will be able to use commands like cl, msbuild etc in the integrated terminal.
Happy coding.

Using UE4 with Visual Studio 2017

I recently did some cleaning of my drives. I decided to install visual studio 2017 after cleaning the drives up. I have been trying to continue work on my old UE4 project using the engine pulled from GitHub. I tried rebuilding the project with VS2017 which I know is not fully supported yet. I did run into quite a few problems, including the missing corecrt.h files. I reinstalled the Windows SDK to fix this.
The current problem is a new missing file called windows.h, and I believe it is missing due to the build tools looking for the wrong version of the SDK. I was wondering, has anyone else successfully integrated Visual Studio 2017 with their UE4 project after running into similar problems?
-- Edited due to poor grammar.
As I know Version 4.15 supports both Visual Studio 2015 (default) and Visual Studio 2017. If you are building the Engine from source code, you would want to open a command prompt after running Setup.bat and run the command GenerateProjectFiles.bat -2017. This will give you a Visual Studio 2017 solution for the Engine.
To use Visual Studio 2017 for projects, you can set your preference for which version projects use by going to Edit -> Editor Preferences -> General -> Source Code and choosing Visual Studio 2017 in the Source Code Editor setting.
If regenerating the Engine's VS project files doesn't help. Try regenerating your own UE4 project's VS project files.
With Visual Studio and UE4 closed, find the .uproject file, right click and select Generate Visual Studio project files.
Open the solution, make sure your UE4 game (e.g. MyProject) under the Games folder is set as the StartUp project (right click, Set as StartUp project), then try a compile.

C++ Visual Studio 2013 - additional include directories priority

I'm migrating a Visual C++ 6.0 project to Visual Studio 2013. After solving many issues I'm stucked at the following problem. I have in my project path a folder with windows sdk .h files ( not all .h. files ).
In the old project I've had in additional include directories the following path : ..\..\sdk\include and the project builds succesfully. But, when I try to add the same path in Visual Studio 2013 I have over 100 errors regarding one of the header files from the sdk folder. (undeclared identifier)
My question is, how do I configure the Visual Studio project in order to search first in ..\..\sdk\include for some of the windows sdk files and then into the default windows sdk folder ?

"Cannot update project reference" error introduced by Visual Studio 2012

I had a command line build which was working fine with Visual Studio 2010.
I am now trying the same solution with Visual Studio 2012.
When I build it via the command line:
devenv MediaPlayer.sln /build "Release|Any CPU"
I get a pile of errors with the website:
37>------ Build started: Project: C:...\Web\, Configuration: Debug
Any CPU ------
37>Cannot update project reference ''. Source project
not available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Cannot update project reference ''. Source project not
available.Validating Web Site
But then I open the SAME solution in Visual Studio 2012, and build it. It builds.
I then run this same build via the command line, and it builds.
So I check it in, and let the build process fetch it into the build directory, and I get THE SAME ERRORS.
At this point, I'm stumped as to what to do next. Any pointers?
When the Visual Studio 2012 build output says
Cannot update project reference
It's actually saying
Something went wrong, and you know what?
I'm not going to tell you what it is!
BWAHAHAHAHAHAHAHAHAHAHAHAHA
After a full days search, it came down to a third party library (Castle.Windsor.dll) not being in the .bin directory. I don't know why this problem showed up with Visual Studio 2012 and not Visual Studio 2010. My guess is that in Visual Studio 2010, this was automatically copied over because it was a dependency of another project the website was dependent on.
I manually created a .refresh file for Castle.Windsor.dll and Castle.Core.dll, and now it builds.
I also experienced this same error when trying to build a solution in VS 2012.
I had a solution that I upgraded from VS 2010 to VS 2012 and then started removing some long dead projects. VS 2012 became "confused" with this removal and deemed that a website project in the solution needed a reference to '', which was not available.
To resolve this, I undid the above mentioned changes to the solution, opened it up in VS 2010, removed the long dead projects and built successfully and then closed VS 2010. I was then able to open/update the solution in VS 2012 and work without issue.

Extend the Visual Studio C++ Build Process

A found an article (Extend the Visual Studio Build Process) that explained how to override build targets in a C# project file. I tested this, and it seems to work well. However, what I really want to do is override a build target in a C++ project (with Visual Studio 2005). The problem is that C++ projects use different XML. Instead of having <project> as the root, C++ projects have <VisualStudioProject> as the root. When I add the <target> tag to a C++ project file and try to open the project in Visual Studio, I get this error:
The following error has occurred during XML parsing:
File:
[Path to Project File].vcproj
Line: 304 Column: 30 Error Message:
Element 'Target' is unexpected
according to content model of parent
element 'VisualStudioProject'.
The file
'[Path to Project File].vcproj'
has failed to load.
How can I override a Visual Studio build target for a C++ project? Or is there a better way to customize what happens during a C++ build?
In Visual Studio 2005 there are no build "targets" for C++ builds as the C++ build system does not use MSBuild.
However, VC++2005 defines the Pre-Build, Pre-Link, Post-Build Events as well as the ability to add a Custom Build Step for non-standard files.
You may be able to achieve what you want using these settings.
Note:
VC++2005 projects can be built using MSBuild, it's just not what Visual Studio does out of the box.
Visual Studio 2010 uses MSBuild for all project types.