- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I forget asking thsi question. During debugging the code, could I use immediate window of VS? Is there any command? For example, I want to display an array, A. I input print *,A in the immediate window. Is this possible?
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - yingwu
I forget asking thsi question. During debugging the code, could I use immediate window of VS? Is there any command? For example, I want to display an array, A. I input print *,A in the immediate window. Is this possible?
Well, I had never heard of the immediate window so I went poking around a bit.
Yes, you can use the immediate window to display Fortran variables, but quite frankly, I like the Locals window, the Watch window, or the tool-tip better.
If you want to use the Immediate window, use
>debug.print a
- Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Lorri Menard (Intel)
Well, I had never heard of the immediate window so I went poking around a bit.
Yes, you can use the immediate window to display Fortran variables, but quite frankly, I like the Locals window, the Watch window, or the tool-tip better.
If you want to use the Immediate window, use
>debug.print a
- Lorri
Hi, Lorri. When a breakpoint is set, you can call the immediate windows by Ctrl+Alt+i. I tried debug.print a, but the VS returns
debug.print i
Undefined variable debug
So it does not work. But it is OK. Could I ask what you mean 'the Locals window, the Watch window, or the tool-tip better'? What is locals window or the tool-tip? I know the watch window, but could I ask how to use it?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - yingwu
Could I ask what you mean 'the Locals window, the Watch window, or the tool-tip better'? What is locals window or the tool-tip? I know the watch window, but could I ask how to use it?
Thanks!
Thanks!
When you are debugging using Visual Studio set a breakpoint somewhere in your code then run the program. When it reaches the breakpoint and pausesthen the Debug menu has the following options (among others) :
Debug->Windows->
Watch has 4 watch windows available where you can view the values of your variables.
Locals which shows the variables and their values local to the current routine (where your beakpoint has been set)
Call Stack showsC was called fromB (with the list of arguments) B was called fromA and so on
Memory has 4 windows where you can see the contents at a specified address.
This way you don't necessarily need to "print" values to a window or file you just display them in a watch window when you reach a breakpoint, or if you hover the mouse over a variable inthe source file then its vale or values for an array,are displayed as a "tooltip" popup.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Les Neilson
When you are debugging using Visual Studio set a breakpoint somewhere in your code then run the program. When it reaches the breakpoint and pausesthen the Debug menu has the following options (among others) :
Debug->Windows->
Watch has 4 watch windows available where you can view the values of your variables.
Locals which shows the variables and their values local to the current routine (where your beakpoint has been set)
Call Stack showsC was called fromB (with the list of arguments) B was called fromA and so on
Memory has 4 windows where you can see the contents at a specified address.
This way you don't necessarily need to "print" values to a window or file you just display them in a watch window when you reach a breakpoint, or if you hover the mouse over a variable inthe source file then its vale or values for an array,are displayed as a "tooltip" popup.
Les
Hi, Les. It is very useful. Then I have a new problem. I find if I compile the project without any optimization, I can see the values of variables. However, if set to maxmize speed plus higher level optimization, I can not see the values. I attach a picture below. Is there any way to solve this? Thanks....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In this case the optimization has caused the values of some variables to not be stored in memory but in a register instead. You could use the Debug->Windows->Register window to see them but :-
While debugging it is best to have optimization turned off and all run-time checks turned on. You should only need to turn on optimization for your release version once you have fixed any bugs.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - yingwu
Hi, Lorri. When a breakpoint is set, you can call the immediate windows by Ctrl+Alt+i. I tried debug.print a, but the VS returns
debug.print i
Undefined variable debug
So it does not work. But it is OK. Could I ask what you mean 'the Locals window, the Watch window, or the tool-tip better'? What is locals window or the tool-tip? I know the watch window, but could I ask how to use it?
Thanks!
Now that you've discovered the wonderful watch windows, I know you're not using the immediate window anymore but ...
You need the leading ">" character, as:
>debug.print i
That tells the debugger that it should use its own "debug.print" utility.
- Lorri

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page