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

Relative file paths

JonShaw
Beginner
1,357 Views
My Fortran program contains relative file paths, e.g.

data/output.txt

What determines where these paths are taken "relative" to?

When I compiling on Windows (using IVF 11.1 integrated into VS2005), the base directory is taken as the VS project folder (where the source files are), even though the object, module and executable files are saved into the Debug or Release subdirectory.

On Linux (using IVF 11.0), I am trying to preserve the VS-style directory structure (i.e. Debug and Release subdirectories). This means (in simplified terms) compiling with commands along the lines of:

ifort -o Debug/functions.o -module Debug/ -c functions.f90
ifort -o Debug/main.o -module Debug/ -c main.f90
ifort -o Debug/prog.out Debug/main.o Debug/functions.o

When I do this, the base directory is taken as the Debug folder, not the folder where the source files are.

What do I need to do to make the two consistent? Can I set something on the command line to determine the base directory?

Thanks.
0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,357 Views
When you run from inside Visual Studio on Windows, VS sets the default to be the folder directory. But if you run the EXE from outside VS, or on Linux, the default is the directory containing the executable. In VS you can set a different default directory on the Debugging property page ("Start in").
0 Kudos
Reply