I have a Visual Studio C++ Win32 Console application project. In the properties of the project I have set a Preprocessor definition VERSION=$(Version) and currently I use this macro in the code. The only problem is that the $(Version) appears to resolve to 1.0.0.0. I have searched the web and the project properties but I couldn't find the appropriate way to set this via the IDE. Also I tried to set the Linker-Version property but it didn't help as the $(Version) still 1.0.0.0.
Related
Background:
I found some answers for this question but they were focused more on earlier versions of visual studio for which it seems some things have changed. My issue is I've created a new build configuration called 'Profile' for which I would like to have a corresponding macro for similar to how visual studio's 'Debug' build has '_DEBUG' macro.
Question:
Where, in visual studio 2015, would I go about declaring a macro connected to my build configuration so I can use #if, #ifelse and other defines with the macro in my code? This relates to C++.
I'm experienced w/C# and C, but not with C++. I need to interface to an API in C / C++, so I'm off to learn C++ with Visual Studio 2015 Pro.
I built a very simple example to test the library of classes (as a static library) being used in a console application for testing.
I cannot add my library as a reference because VS 2015 claims that they target different platforms. However, the properties indicate the same platform.
What is this error telling me that I don't understand?
I'm using Visual Studio 2015 and doing something similar.
I had the same problem and I think what happened was maybe I chose the "static library" project and "executable" project from different submenus in the Visual Studio project creation wizard.
I went back through the project creation wizard and made sure I selected an executable type from the same category as my static library (in my case, "Universal Windows"). That platform setting is shown in parentheses after the Project name and seems to be different than the SDK settings the error seems to refer to.
I was looking for a way to "convert" my project from "Visual Studio 2010" (its original setting somehow) to "Universal Windows" but I haven't found one yet. I tried using Solution Explorer's "Retarget solution" option (in the right click context menu for the solution) but all it did was get me off Visual Studio 2010 and onto something that didn't have a reference at all. So I made a new project and copied the files over into it.
With the hope of getting trained for C++ as a zero newbie, I was following directives to create a C++ dev environment on a PC equipped with Windows 10 and Visual Studio 2015 Community Edition.
I create a new C++ project on VS 2015 CE
When I right-click project properties, I cannot locate C/C++ > Preprocessor - it's just not there as can be seen from the screenshot.
So trying to figure out how on Earth I can add some custom preprocessor definitions here. :-(
Add at least one .cpp or .c file to your project (or, more generally, an item with ItemType "C/C++ Compiler").
A desired entry will appear in Project Property Pages (exactly where you expect it to be):
Configuration properties -> C/C++
There will be subentry "Preprocessor".
Alternatively, you may create a project of type
Visual C++ -> Win32 -> Win32 Console Application (or, more general, Win32 Project)
This type of projects already contains C++ files with some simple code.
I'm working on a C++ dynamic library that I want to use in Unity3D, except I'm encountering an error somewhere in it and would like to debug it in visual studio. To do this, I would like to convert the VS2010 project temporarily into an .exe project. What steps would I need to follow to do this? I've already tried changing the target extension, linker output file, and set the entry point but it just won't start.
Found that I can attach the VS debugger to Unity3D process, which does what I need.
I'm trying to do some tutorial C++ programs to familiarize myself with the language. I'm using Visual Studio 2010. I have a Visual Studio solution with two projects - I'll just call them projectA and projectB. Each project has a source file with its own main method. However, when I try to run the program in projectB, the program in projectA runs instead. I'm coming from an Eclipse IDE where projects separate the programs. I've some msdn articles on solutions and projects, but I haven't seen anything about being unable to have multiple source files with main methods in them. Can someone help to clarify the Visual Studio Solution/Project structure for me, please.
Right click on the project you want to run, and select Set as StartUp Project
You have to right click on the project and "Set as Startup Project" to tell Visual Studio which project you want to actually run.
I hope this is a nice simple fix: if you look at your solution and have both projects open, you should be able to right click one of them and set it as default (Set as Startup Project), (which sounds like at the moment is set to projectA).
I have highlighted the relevant option in the menu picture:
Either you can right click on the project in the Project Explorer and select Set As StartUp Project or you can use meny item Project and also select Set StartUp Project.