Set up project properties environment variable
I am new to microsoft windows visual studio 2008 IDE , Was looking for How to set environment variables when debugging in Visual Studio?
My project is in c/c++ windows console application.
Set Environment Variables in VS2008
Here are few simple steps to add environment variable.
- Open your project.
- Go to Project>Properties or pres Alt+F7
- Under Configuration Properties>Debugging, edit the ‘Environment’ value to set environment variables.
I wanted to set and add the directory “C:\Program Files\Hummingbird\Connectivity\13.00\Exceed” to the path when debugging app X applications, set the ‘Environment’ value to
PATH=%PATH%;C:\Program Files\Hummingbird\Connectivity\13.00\Exceed;C:\Program Files\Intel\Compiler\Fortran\10.1.021\IA32\Bin
Set System Wide Environment Variables in Windows PC
Other way to set up this is using system wide environment variable.
- Right click “My Computer”, Select properties
- Select the “advanced” tab
- Click the “environment variables” button
- In the “System variables” section, add the new environment variable that you desire
- “Ok” all the way out to accept your changes
Note : Visual Studio 2003 doesn’t allow you to set environment variables for debugging. In this case one can use _putenv function.
source – Windows Sysinternals: Documentation, downloads and additional resources
Number of View :1020
How to run .exe in debug mode microsoft visual studio 2008?
Here are few solutions I got for Running .exe in debug mode using the Windows debugger.
Devenv allows you to set various options for the integrated development environment (IDE);
Loads a Visual C++ executable under the control of the debugger. This switch is not available for Visual Basic or Visual C# executable.
Example : if your win32 binary executable name is test.exe then, to run this win32 binary in debug mode use this command on windows command prompt.
C:\tmp>devenv /DebugExe test.exe
Your default debugger will start and loads this binary for debug mode. Then just hit F10 Key to go to main function. For Now on your debugging starts, ie to step into function use F11 key, you can put breakpoints and all debugging stuff.
I assume that you have compiled the binary test.exe with debug flag enabled, else debugger will not find the debug symbols and will not load the code.
Using Image File Execution Options
To setup an application to launch the debugger automatically.
How to: Launch the Debugger Automatically
the Image File Execution Options folder, locate the name of the application you want to debug, such as myapp.exe. If you cannot find the application you want to debug:
- right-click the Image File Execution Options folder, and on the shortcut menu, click New Key.
- Right-click the new key, and on the shortcut menu, click Rename.
- Edit the key name to the name of your application; myapp.exe, in this example.
How to open a file, and go to a line number
devenv /edit E:\code.cpp /command “edit.goto 45″
In this example, devenv will open the code.cpp file, and go to line 45.
Number of View :1863
Was getting Error __curr_eh_stack_entry and __eh_curr_region With pgcpp C++ Compiler.
check out complete man pgcpp - The Portland Group Inc. C++ compiler
Building an application software using pgcc compiler, developed by C++ Language generates two external references of symbols [__curr_eh_stack_entry] and [__eh_curr_region], and results in kink error. Why?
How To Resolve Error __curr_eh_stack_entry and __eh_curr_region With pgcpp C++ Compiler?
Compiler automatically generates these symbols when -exception (C++ exception handling) and -rtti=on (Runtime type information) options are used. If these option is not required to use, Please do not enable them.
-rtti(default) –no_rtti An pgcc compiler option switch.
Enable (disable) support for RTTI (runtime type Information) features: dynamic_cast, typeid.
Number of View :837
I use the function _access to check for file/directory existence in my program,
Problem definition: I have noticed that the function can’t deal with long file names. I wanted to check if file is available or not at path located “C:\Documents and Settings\0001″, did Google search on how to give long file names in windows..
How To _access Function For Long File Names As Path In Winddows Programming make Use of UNC standards
Solution use the UNC(Universal Naming Convention) conventions for path to be specified while working with windows programs.
ie the path should be “C:\\Documents and Settings\\0001″
Now The next problem is wanted to use period ie . in file name path,
Eg. I need to use the path as “C:\\Documents and Settings\\.test\\0001″
So tried with something like “\\.\” But The “\\.\” prefix will access the Win32 device namespace instead of the Win32 file namespace.
Then how to Turns off automatic expansion of the path string? Use the “\\?\” prefix also allows the use of “..” and “.” in the path names. To specify an extended-length path, use the “\\?\” prefix. For example, “\\?\D:\<very long path>”. Read more about Naming Files, Paths, and Namespaces
That did not help much, and tried directly with “C:\\Documents and Settings\\.test\\0001″ It works.
you can also try the PathFileExists function
access function Return Value
Each function returns 0 if the file has the given mode. The function returns –1 if the named file does not exist or is not accessible in the given mode;
Do share your questions and views..
Number of View :775
Was getting below link errors when compiling application with fortran files and c files. Was using ifort.exe and cl.exe to compile and link.
error LNK2019: unresolved external symbol _getenv_ referenced in function xyz
error LNK2001: unresolved external symbol _getenv_
Usage in fortran file, this is call to getenv
CALL GETENV (“LIB”,libname)
After few hours of google got different solutions, saying using assume:nounderscore flag in compilations.
tried with assume:underscore , assume:nounderscore and assume:no2underscore
And use ifport.lib and ifcore.lib but did not got the error resolved.
If this error was happen to come from .c file then solution is direct ie use stdlib.h include file.
Finally got the Solution
Add these two lines in your FORTRAN file,
and compile again the error goes away.
Some description about USE
The USE statement gives a program unit accessibility to public entities in a module.
getenv and _putenv use the copy of the environment pointed to by the global variable _environ to access the environment. getenv operates only on the data structures accessible to the run-time library and not on the environment segment created for the process by the operating system.
In a program that uses the main function, _environ is initialized at program startup to settings taken from the operating system’s environment.
Happy application porting from UNIX to win32.
Number of View :1297