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

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.

Related

Importing a folder into Visual Studio 2017

I am a college student and often I am given project folders for courses with multiple C++ header files, source files, and a makefile usually. I am using Visual Studio 2017 for reference.
Visual studio is my favorite IDE for debugging but I do not know how to integrate one of these folders into Visual Studio so I might debug from the application and not from a terminal. I am wondering if someones knows a way for me to open this folder in VS, and run/debug it like a normal console application? I realize the makefile might add an additional layer of complexity.
This is an image of the contents of a folder I want to be able to run/debug/execute normally in visual studio
I can open this folder in visual studio by right clicking -> open in visual studio.
However when in visual studio, I cannot build, run, debug or anything. Visual studio is acting more like a text editor than an actual IDE. I would like to be able to build/make my program through visual studio so I can launch/debug it in visual studio.

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.

How to i open this applications is visual studio so i can run the code?

I have this application code on the following remote server
https://svn.reactos.org/reactos/trunk/reactos/base/applications/rapps_new/
I have tried making a windows application in visual studio and adding the files to it, but it doesn't compile.
Whats the correct way to run the code?
You need to use CMake to generate a Visual Studio solution for the project. Then you will be able to import your solution into Visual Studio and build it.

How to compile source C++ code that doesn't have a project file?

I have just started learning more about C/C++ and I am using Visual Studio 2013 to manage the code.
A project I am working on to use the Tobii EyeX eye gaze system requires me to be able to tweak this code slightly, however I do not understand how I can compile this code to an exe file without a Microsoft Visual Studio project file. This is that code:
https://github.com/MastaLomaster/bkb
In the source folder you see all the project's files but not an actual project file. How would I go about compiling this code? Where do I start? I can not seem to be able to load this is Visual Studio at all - the programmer of the code says (at the bottom of the Github page):
Compiling the source codes As for now, you have to use Microsoft
Visual Studio 2012 (latest update preferred)...
Either create a makefile(if no makefile is exist) for visual studio using nmake or you can use the suggestion provided in this link.
Additionally you can create a project by adding these codes as source. follow this link.

Building Visual Studio 2008 solution from command line

I'm trying to automate the building process for a certain open source project. It will do an update on the SVN directory, use CMake to get a .sln file, and build that. I can successfully do this manually, and do svn and cmake from a batch script, but Now I need to build the solution.
A quick google search revealed:
devenv /build release /project <projname> <solutionfile>.sln
However, that uses the latest version of visual studio (Visual Studio Professional 2011), while the .sln file generated is for Visual C++ Express 2008. I have both versions installed on my computer. Is there a devenv I can use for Visual C++ Express 2008? Or is there a commandline argument to specify which version to use?
UPDATE
I tried using msbuild, but that didn't seem to like building .vcproj files directly, and I didn't want to build ALL the project files by having it build the .sln file. I ended up using this:
"C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages\vcbuild.exe" <myproj>.vcproj "Release|Win32"
I think you are using the wrong tool to build this. Rather than trying to drive the IDE from the command line you should simply use msbuild.
msbuild.exe projectname.proj /property:Configuration=Release
In order to set your environment up for the specific version of MSVC you need to call the vcvar.bat file from that specific version. This will set up the necessary environment variables needed by the build tools.
For Visual Studio Express 2008 the IDE is called VCExpress.exe. Also you should probably specify the full path of the program when you have two versions installed:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCExpress.exe /build release /project <projname> <solutionfile>.sln