- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm working on a code developed in Visual Studio. If I run the cose in debug mode the code works. If I run the code in release mode there is an error:
forrtl: The handle is invalid
forte (39): error during read unit 0, file conout$
How can I fix it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reading from unit 0, stderr, is very unusual. I would agree with Arjen that uninitialized variables are likely, though in release mode I would not expect it to use unit zero.
You can enable the traceback option in the Release mode (Fortran > Run-Time > Generate traceback), and then when you get the error it will tell you at which line the error occurred. That should give you a head start.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You do not give us much to go on - like the code that exhibits this problem. So we can only speculate.
This type of things - different behaviour between the Debug and Release version, or even running within or without the debugger - is often an indication of uninitialised variables. Apparently, your program is reading from one or more files. I would check the LU-numbers for these files and see whether the variables used all have proper values assigned to them. Beyond that advice, it is best to provide us with a small program that demostrates the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arjen Markus wrote:
You do not give us much to go on - like the code that exhibits this problem. So we can only speculate.
This type of things - different behaviour between the Debug and Release version, or even running within or without the debugger - is often an indication of uninitialised variables. Apparently, your program is reading from one or more files. I would check the LU-numbers for these files and see whether the variables used all have proper values assigned to them. Beyond that advice, it is best to provide us with a small program that demostrates the problem.
Thank you for you reply. The code is too large and I can not attached. Maybe there is some uninitialised variables. Is there a way to find them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
One possibility - though it may not be 100% foolproof - is to add the compiler option /RTCu which will report the use of uninitialised variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Arjen Markus wrote:
One possibility - though it may not be 100% foolproof - is to add the compiler option /RTCu which will report the use of uninitialised variables.
Thanks again. Do you know how can I do it in Visual Studio?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reading from unit 0, stderr, is very unusual. I would agree with Arjen that uninitialized variables are likely, though in release mode I would not expect it to use unit zero.
You can enable the traceback option in the Release mode (Fortran > Run-Time > Generate traceback), and then when you get the error it will tell you at which line the error occurred. That should give you a head start.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Ret.) wrote:
Reading from unit 0, stderr, is very unusual. I would agree with Arjen that uninitialized variables are likely, though in release mode I would not expect it to use unit zero.
You can enable the traceback option in the Release mode (Fortran > Run-Time > Generate traceback), and then when you get the error it will tell you at which line the error occurred. That should give you a head start.
Thank you so much Mr. Lionel. Could you tell me more about Generate traceback? I can't find it. I use Visual Studio 2015.
Thank you again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Configuration Properties > Fortran > Run-Time > Generate Traceback Information > Yes (/traceback)
https://msdn.microsoft.com/en-us/library/z15yzzew.aspx ;
"How to: Modify Project Properties and Configuration Settings"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
andrew_4619 wrote:
Configuration Properties > Fortran > Run-Time > Generate Traceback Information > Yes (/traceback)
https://msdn.microsoft.com/en-us/library/z15yzzew.aspx
"How to: Modify Project Properties and Configuration Settings"
Thanks. I activated it. But I'm not able to find the breakpoint yet. Is it showed automatically or should I go in some windows to watch it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I fix it! it was an initialised variable. Thank you to everyone!

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