- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to run Amplifier from MSVS with included Inheritance of the project properties.
My sample is quite easy:
#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <iostream> #include <cstdlib> #include <string> using namespace std; int main() { // Variable 1. string anEnv1 = getenv("ENV1"); if (anEnv1.size() != 0) cout << anEnv1 << endl; else cout << "ENV1 read problem" << endl; // Variable 2. string anEnv2 = getenv("ENV2"); if (anEnv2.size() != 0) cout << anEnv2 << endl; else cout << "ENV2 read problem" << endl; }
I set these variables in "Project->properties->debugging->Environment" via visual studio. So this example works in standalone mode. When I try to use Amplifier behaviour is incorrect.
Physically this variables are stored in vcproj.user file which can be obtained after cmake execution. Here are this lines:
<LocalDebuggerEnvironment>ENV1=D:/ENV1DIR
ENV2=D:/ENV2DIR
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
I can provide full sample in case of necessity.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alexander:
I can't even get it to work without VTune Amplifier! When I attempt to run your sample under the debugger, I receive a debug assertion because getenv() returns a null pointer.
I've set my debugger environment as follows:
I've tried with and without semi-colons - no difference in behavior. If I replace "ENV1" with "TEMP", then I am able to retrieve the system variable. What am I missing? :\
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello MrAnderson!
Why there are 4 variables?
On my original case inheritance lead to situation when one of the variables became unavailable and application profiling crash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FYI:
Original problem is observed on MSVS2010+Amplifier XE 2013 (Update 16). Attached screenshots are obtained on MSVS2013+Amplifier XE 2013 (Update 16)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Okay, thank you. I am seeing some strange behavior, as well, and have reported this to the development team.
The workaround for you would be to define these variables in the environment that you start Visual Studio from. For example, if you open a command prompt, set the variables, start devenv, then VTune Amplifier as well as your app will inherit those variables from the command prompt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi MrAnderson,
I've used this workaround and confirm that it is work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Alexander:
I have an update. This is something peculiar about the Visual Studio* project settings. When you open the project settings, you need to make sure the "Configuration" where you are defining the variables *matches* the one that you are executing:
Once I changed "Release" to "Active(Debug)" and set the variables, everything worked!!
This oddity of Visual Studio has bitten me before. :( Hope that helps.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page