Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Executable not working on other computers

spxnge
Beginner
435 Views
This is probably a really stupid question, but here goes:

I've created an exectuable using IVF, and when I try to run it on my desktop computer (I'm creating the .exe on my laptop), the program fails. I've also tried the .exe. on another machine, and the program fails at a different point.

The issue seems to be related to the fact that I have an input file that lists the directory paths for three other required files (this is updated when attempting to run on other computers). The console error reads:

forrtl: severe (29): file not found, unit 10, file "directory"

Where do I change the reference to "directory" above? If possible, I'd like this to be the directory in which the executable is located.

Any help would be greatly appreciated.
0 Kudos
2 Replies
DavidWhite
Valued Contributor II
435 Views
Can you post a sample of your code, including the OPEN statement used for the file?

You need to make sure that you are trying to open the file in the correct folder, and use the IOSTAT return code on the Open statement to take appropriate action if the file is not found.

David
0 Kudos
jimdempseyatthecove
Honored Contributor III
435 Views

Also note, when you launch an application it can be launched by command (e.g. Start | Run | DrivePathProgram or in CMD window),or by shortcut, or by click from browser.

When the program is run the "current drive" and "current directory" are not necessarily where the program is located. Therefore, if your application has (requires) a companion file to be co-locatedwith the application then the well writtenapplication will determine the "run from" location rather than assuming the program location is "current drive" and "current directory" (alternately known as "." or simply no prefix).

The 0'th argument on the command line by convention includes the fully qualified path which you can then parse to obtain the run from path (permit "" and "/" in parsing for token seperator). There are other API calls you can use to get the program location if you prefer.

Note, when you find your companion file that contains the paths the use of relative paths are relative to the current drive and directory which is not necessarily relative to the program location (nor the location of the companion file).

Jim Dempsey

0 Kudos
Reply