简体   繁体   English

使用Visual Studio 2012配置c ++ win32控制台应用程序

[英]Profile a c++ win32 console application with Visual Studio 2012

I have a simple (not so simple) win32 console application in c++. 我在c ++中有一个简单的(不那么简单)win32控制台应用程序。 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" . 发生错误: "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 我在Windows 8上使用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 . 我想获得类似xcode的东西。

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 我已经尝试了x64和/或Win32的发布模式和调试模式

在此输入图像描述

Note2 笔记2

In this project I have created two custom property sheet (to include the right opencv libraries) 在这个项目中,我创建了两个自定义属性表(包括正确的opencv库)

- OpenCV-Release
- OpenCV-Debug

Note3 注3

在此输入图像描述

Open the projects properties.> Configration Manager > Active Solution Platform > select New > and follow my screen shot. 打开项目属性。> Configration Manager> Active Solution Platform>选择New>并按照我的屏幕截图。 Your perfomance analysis will run after this. 您的性能分析将在此之后运行。

The project is not being recognised, as you have it configured with x64. 由于您使用x64配置了该项目,因此无法识别该项目。 (As evidenced by your first screenshot under Note ) (正如您在Note下的第一个截图所示)

Win32 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. 由于您的项目是在64位操作系统中创建的,您需要手动将项目与win32 sys链接,因此探查器会将项目识别为win32项目。

http://en.wikipedia.org/wiki/Windows_API 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. 在Visual Studio中保存项目必须有条不紊地一致地完成。

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). 如果创建项目并将其保存在文件夹中(例如)C驱动器中的文件夹A,然后重新排列文件夹,然后项目位于文件夹A中,但文件夹A已移动到D驱动器(或任何变体)变化)。 Visual Studio, will not be able to find the project. Visual Studio,将无法找到该项目。

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. 为什么我的文件夹被安排无关紧要,因为它们就足够了,我发现将它们与C盘中的程序文​​件保持在一起更容易。

Please note the file in the first screen shot extension vspx, is a visual studio performance report. 请注意第一个屏幕截图扩展名vspx中的文件,是一个可视工作室性能报告。

Visual Studio Project Folder Visual Studio项目文件夹

Visual Studio Sub Folder Visual Studio子文件夹

This may or may not answer your question. 这可能会也可能不会回答您的问题。 Please advise if you need more assistance. 如果您需要更多帮助,请告知。

The short cut- 捷径 -

VS Release VS发布

The long steps - which give you more options 漫长的步骤 - 为您提供更多选择

VS Debug menu VS Debug菜单 VS配置按钮 VS Configuraion Manager Please try this (it is the same answer on both links): VS Configuraion Manager请试试这个(这两个链接都是相同的答案):

<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 http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/56dcdb2a-5e30-4015-bc14-244f99f07b8b

Profiling with CMake, C++, and Visual Studio 2012 使用CMake,C ++和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. 将文件添加到项目外部的目录中,然后在属性 - >配置属性 - > C / C ++ - >常规中的“其他包含目录”中引用这些目录。

VC++ Visual Studio added .hpp files in subdirectory but get "Error: cannot open source file ..." VC ++ Visual Studio在子目录中添加了.hpp文件,但得到“错误:无法打开源文件......”

You can launch the performance wizard, under the Analyze tab. 您可以在“分析”选项卡下启动性能向导。

This is a known bug in VS. 这是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. 请注意我的项目是下载的样本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以在Visual Studio的Win32 C ++应用程序的控制台中进行调试? - Is it possible to debug in console in a Win32 C++ Application in Visual Studio? 安装 C++ 组件后,在 Visual Studio 2015 中看不到 Win32 控制台应用程序 - Not seeing Win32 Console Application in Visual Studio 2015 after installing C++ components 将C ++ Win32 Console项目类集成到Visual Studio 2008中的Visual C ++(Windows窗体应用程序)项目中 - Integrate C++ Win32 Console project classes into Visual C++ (Windows forms application) project in Visual Studio 2008 Windows 8的Visual Studio 2012不显示Win32控制台应用程序选项 - Visual Studio 2012 for windows 8 not showing win32 console application option Visual Studio 2017 C ++ Win32控制台项目模板 - Visual Studio 2017 c++ win32 console project template Visual C ++ Win32控制台应用程序printf在while循环内的多行输出 - Visual C++ Win32 Console application printf output on multiple lines within while loop XPe中的Autostart C ++ win32控制台应用程序 - Autostart C++ win32 console application in XPe Visual Studio 2010 for C ++ Win32中的智能感知能力很差 - Poor intellisense in Visual Studio 2010 for C++ Win32 Visual Studio:“不是 Win32 应用程序”错误 - Visual Studio: "Is not a Win32 application" error C ++ win32控制台中的颜色 - Colors in C++ win32 console
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM