Visual Studio's profiling API - c++

I can't properly setup manual profiling using Visual Studio's API. I used this MSDN guide to link their lib to my project. But I'm getting unresolved external symbol __imp_StopProfile while trying to launch the code that includes and uses StopProfile function. I've set the path to the profiling library in my project properties and added the name of the library to the linker. I tried to include both VS12 and VS14 versions, no luck.

I believe you are trying to build x64 application which requires x64 VSPerf.lib which can be found at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\x64\PerfSDK. Please note that x64 folder there.

Related

error while building a Hello World wxwidgets app with visual studio 2019

I'm trying build wxwidgets Hello World sample program in visual studio and i'm using prebuilt wxwidgets instead download that and build it myself.
and after configuring visual studio project for wxwidgets i always facing with this error:
Error C1083 Cannot open include file: '../../../lib/vc142_x64_dll/mswud/wx/setup.h': No such file or directory wxwidgets_programming_cpp C:\wxwidgets\include\msvc\wx\setup.h 140
where is the problem. I think i configured visual studio project in a wrong way. can you help me how to configure visual studio project for a regular wxwidgets app?
You need to define wxMSVC_VERSION_ABI_COMPAT in the preprocessor definitions to use these binaries, which will result in using the correct vc14x prefix instead of vc142 used by default. This is already supposed to be done by wxwidgets.props, at least for the DLL configuration which you seem to use, so I am not sure why it doesn't work for you if you do use this file, but at any rate this symbol must be defined and it isn't in your case.

How to run Code Analysis on x64 Project in Visual C++?

I am trying to run the code analysis of Visual Studio 2015 on my x64 VC++ project. However I get the following error:
Error C1250 Unable to load plug-in 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\\bin\localespc.dll'
I am activating the x64 toolset of Visual Studio by running the batch script "vcvarsall.bat amd64" before I start the IDE. Visual Studio is run with the "/useenv" option afterwards.
When I check the VC++ environment variables, I can see that the following path is contained in the PATH variable:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64
How can I tell Visual Studio to use the code analyzer (localespc.dll) from there and not the x86 version which it apparently tries to use (according to the error message).
Thanks a lot for your help!
I was having the same issue with my 64-bit C++ projects. I discovered simply renaming/removing localespc.dll from VC\bin allowed the Code Analysis builds to succeed and still report analysis warnings. It seems if VS doesn't find this dll in the VC\bin directory then it won't add the compiler switch for /analyze:plugin but otherwise passes all the other switches required by the Code Analysis.
Set the following property in your project file: <PreferredToolArchitecture>x64</PreferredToolArchitecture>
This tells Visual Studio to use the 64-bit version of various tools, including code analysis. I found How to make Visual Studio use the native amd64 toolchain helpful on the topic.
Note that renaming localespc.dll no longer solves the problem with Visual Studio 2017. It seems that setting PreferredToolArchitecture is Microsoft's intended way to do this.

Installing glut on visual studio 2013

I'm trying to compile the freeglut utilities from http://freeglut.sourceforge.net/docs/install.php Compiling instructions are not provided for Visual Studio 2013 and I don't see any solution file, nor a visual studio folder.
The instructions for windows are provided in README.win32 and it seems to support being built with cygwin or mingw only.
Frankly I would create my own vcxproj for it and add the cpp files indicated by the buildscripts manually until it builds. That will, at least, ensure that the resulting dll uses the same c-runtime settings as the rest of my Visual Studio projects, produces MSVC compatible libs etc.
Alternatively the freeglut download page does link some 3rd party pre-compiled windows binaries that will either be very convenient to use - or a total #!! ache if its built with a c-runtime linkage that disagrees with your project.

Unable to debug the CRT source files in Visual Studio 2013 debugger

I just installed Visual Studio 2013 and tried to create a "Hello World" console C++ app. I am trying to debug through the CRT source code but I am unable to do so. I notice that the source files are still installed in the Program Files \ Visual Studio location but the debugger is not able to find them. I used to be able to do this in Visual Studio 2012. What is going wrong?
Starting with Visual Studio 2013, the PDB files of the Visual C++ Libraries will no longer be shipped with the VS product. They will be available only through the Microsoft symbol server. So, you need to set the correct symbol server information in your Visual Studio options.
For more information about PDBs and debugger options see this MSDN link.

can you create a lib or dll in VS 2005 and link with VS 2008

I am using visual studio 2008 SP1.
And I am creating a desktop application using MFC.
I have a library I want to link with my application. However, the library was written in WIN32 visual studio 2005.
I am been having a trouble linking:
fatal error LNK1104: cannot open file 'AgentLib.lib'
I am wondering if it is because I am using MFC 2008 and the library was written and compiled with 2005?
Many thanks for any advice,
Make sure you have added the path where your lib files are under project settings in Linker>General>Additional Library Directories
There should be no problem to do that.
You can either
Add the directory where AgentLib.lib is to the library directories of your project.
Add AgentLib.lib to your project (you may get a message box from Visual Studio asking for a rule, but there is no need for one, and it works)
Yes it is possible. f you have issues please Check this links for some help. Also check for any dependent file which is being used by the lib created using VS 2005.