Configuring target platform for my Visual Studio C++ project - c++

I have a visual studio solution with three projects. I want to configure them all for x64 (as I have a X64 machine). I have created the x64 configuration as you can see in the following image.
The x64 configuration can be applied to the first and the third project. It lists in the drop-down box like shown in the following image.
The project in the center is dependent on the project on top and below it, both. But, this project alone does not show x64 in the drop down. Here is the image:
Can anyone tell me what is the problem and how to solve it...

Click on <new> and add X64 and choose to copy its settings from Win32 then change the settings that you want by yourself.

I found out my problem. I had created the configuration X64 from one of the projects. I had to delete the configuration from the other projects and create it again in the other project and only then, it allowed me to set the configuration for that project. When this deleting and re-creating the configuration was done for each project, it worked fine. If only the properties of one project did not show the configuration created in other projects, or if showing, it had allowed to set that configuration to other projects too, then the problem would not have come. I think this is a bug in visual studio.

Related

Visual Studio 2010 Express 64 bit Properties Missing

I'm trying to run OpenCV with Microsoft Visual C++ Express 2010. I'm using Windows 7 64 bit. It seems I have to compile the code (using the OpenCV libraries) as a x64 application. This is fine. I installed the Windows SDK 7.1 that allows you to do this. So now I go to the dropdown menu, configuration manager and select x64 (copying from Win32). But here I run into a problem. I can't seem to edit the properties in this configuration.
If I change back to Win32 and go to project properties I have all the usual options (Configuration Properties -> General, Debugging, VC++ Directories etc.). But in x64 all I have is a practically blank window that has the Common Properties->Framework and References menus. I can't modify anything.
If I try adding a new property sheet in the Property Manger to Debug|x64, I can name and add it, but when I click on it says "There are no property pages for the selection".
I have searched every possible relevant forum for this! Maybe I'm just using the wrong search terms, but I can't seem to find anyone with this exact problem. Am I just missing something about using properties? Or is this a bug?
Thanks!
Visual C++ compilers are removed when you upgrade Visual Studio 2010 Professional or Visual Studio 2010 Express to Visual Studio 2010 SP1 if Windows SDK v7.1 is installed. For anyone else who has come across this problem I would recommend updating Visual Studio 2010 SP1 via the below link.
http://www.microsoft.com/en-us/download/details.aspx?id=4422
Cheers.
Well, even I faced a problem something similar to this in the start, I am not sure, whether my approach would solve your problem, but, let me give it a try.
After making it x64 as explained in your first step, just click on "ok" and close that window, now, select your project or right click on it, you ll find project properties at the bottom, then use it, you ll find all the available options you need.
when you say, you are seeing "common properties" which means that, you are trying to access the properties of solution not the project, so, select the project before accessing its properties.
your approach of adding a property sheet must work well, go to property manager ->right click on debug/64-> add new property sheet -> name it, save it, you must access it from the next go.
Just to let anyone know who might be having the same problem, I didn't manage to fix it but I did find a work-around. The latest version of OpenCV (2.4.8 I think) would not compile as a 32 bit application. It gave me an error which apparently means there is a conflict because I have a 64 bit OS. As I stated above, I couldn't get the x64 configuration working correctly. My work-around was to use an older version of OpenCV (2.4.6) and this works fine as a 32 bit application. It has the same functionality. The official OpenCV website has a list of previous versions. Now I have it all working fine!

Incorrect main method running in visual studio

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.

Profile a c++ win32 console application with Visual Studio 2012

I have a simple (not so simple) win32 console application in c++. I would like to profile this application, but when I try to:
DEBUG > Start Performance Analysis
An error occurs: "No launchable projects are available for profiling".
Please note that the project compiles and runs normally. It's jus the profling that is not working.
How can I solve? I am on Windows 8 with Visual Studio Ultimate 2012
Note that I choose for this project a simple:
File > New Project > Win32 > Win32 Console Application (C++)
I would like to obtain something like xcode does.
A simple list for each functions or methods the cumulative time of usage.
This is the error when I try "Start performance analysis"
Note
I have tried both release mode and debug mode with both x64 and or Win32
Note2
In this project I have created two custom property sheet (to include the right opencv libraries)
- OpenCV-Release
- OpenCV-Debug
Note3
Open the projects properties.> Configration Manager > Active Solution Platform > select New > and follow my screen shot. Your perfomance analysis will run after this.
The project is not being recognised, as you have it configured with x64. (As evidenced by your first screenshot under Note)
Win32
As your project is created in the 64bit os, you need to manually link the project with the win32 sys, so the profiler will recognize the project as a win32 project.
http://en.wikipedia.org/wiki/Windows_API
I will leave this here, as it may be useful for some users.
Saving projects in Visual Studio, must be done methodically and consistently.
If a project is created and saved in a folder (for example) Folder A within the C drive and then later the folders are rearranged and the project is then in Folder A, but folder A has been moved to the D drive (or any variation of changes). Visual Studio, will not be able to find the project.
Be sure to check that all your files for this project are in the correct folders. You need to open the sub folder and make sure that all the files for your project are present.
Please see my screen shots. It doesn't matter why my folders are arranged, as they are, suffice to say, I have found it easier to keep them with the program files in the C drive.
Please note the file in the first screen shot extension vspx, is a visual studio performance report.
Visual Studio Project Folder
Visual Studio Sub Folder
This may or may not answer your question. Please advise if you need more assistance.
The short cut-
VS Release
The long steps - which give you more options
VS Debug menu
VS Configuraion Manager
Please try this (it is the same answer on both links):
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/56dcdb2a-5e30-4015-bc14-244f99f07b8b
Profiling with CMake, C++, and Visual Studio 2012
And this link as well.
Add the files to a directory outside of the project and then reference those directories in the "Additional Include Directories" in Properties -> Configuration Properties -> C/C++ -> General.
VC++ Visual Studio added .hpp files in subdirectory but get "Error: cannot open source file ..."
You can launch the performance wizard, under the Analyze tab.
This is a known bug in VS.
Without seeing your computer, it is hard to know what else, I can suggest. I do know that it's important to go through all the suggested steps to trouble shoot. If I can find anything else, I'll let you know.
Please note my project is a downloaded sample.

Visual Studio will not give me the platform option of 64 bit in configuration manager..?

I am currently trying to build a project for a 64 bit computer, but the configuration manager doesn't list 64 bit as an option. It gives me Win32, but no x64 (under "Platform"). I am using Visual Studio 2010 C++ Express.
It works on my other computer, but not this one. Most everything I have read has been saying to go up to the "Active Solution platform" drop down, and add 'x64' to it. I have tried that, but it still only lists Win32.
Select the Configuration Manager as given by the following picture.
The Select "New" from the menu as given by the following picture.
After that you will populate with following dialog box.
Once the process is completed, you will get the "x64" platform settings.
Now you can select the Platform via Configuration Manager.

64bit deployment

I would like to start making my application's 64bit, however, I am not sure on the changes I should make on my sln and vsproj files. What changes should I make to my sln and vsproj to make them 64bit?
On the same note, are there changes to the default sln or project file that are good for game development? I am using Visual Studio 2010.
From the VS menu select Build|Configuration Manager.
On the Configuration Manager dialog, open the Platform drop down and select <New...>.
On the New Project Platform dialog select x64 as your platform and click Ok.
To add to what was said before, make sure you understand why you need 64-bit support. In most cases you won't need access to larger memory allocations. Also, be aware that there will be x86/x64 P/Invoke compatibility problems (if you plan on using third-party unmanaged assemblies - in case you are working with managed C++).
For more information, read what Scott Hanselman has to say about this. Also, just as a sidenote, I would recommend reading this blog post that explains some of the migration ideas.
you need to add x64 solution platform:
Build -> Configuration Manager -> Active Solution Platform -> New -> New platform = x64
if you don't see "x64" make sure you installed it in Visual Studio installer
then just select "x64" as active solution platform and build