Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
9 Views

command not found error

Hi guys,

I am pretty a new learner in Fortran. I am running a code in Fortran 90 on linux. I am using gfortran -macmodel=medium -o file silename.f90 to compile the code and making it executable. After doing this I got the error

online@balmr:~/group/Far/Fortran$ ./centroidmega-pimms2.f90
./centroidmega-pimms2.f90: line 1: Program: command not found
./centroidmega-pimms2.f90: line 2: $'\r': command not found
./centroidmega-pimms2.f90: line 3: Implicit: command not found
./centroidmega-pimms2.f90: line 4: $'!\r': command not found
./centroidmega-pimms2.f90: line 5: Centroids: command not found
./centroidmega-pimms2.f90: line 6: Kasra: command not found
./centroidmega-pimms2.f90: line 7: $'!\r': command not found
./centroidmega-pimms2.f90: line 8: $'\r': command not found
./centroidmega-pimms2.f90: line 9: syntax error near unexpected token `('
./centroidmega-pimms2.f90: line 9: `  Integer, Parameter :: wp = Selected_real_k'nd( 12, 70 )

I am pretty sure that the code that I am working is bug free as my colleague run it his self. Any help would be very appreciated.

Best,

Farzaneh

 

0 Kudos
6 Replies
Highlighted
Employee
9 Views

You accidently tried to

You accidently tried to execute the Fortran source file and not the executable you built. Maybe you just need to drop the ".f90" assuming you named the executable: centroidmega-pimms2

0 Kudos
Highlighted
Black Belt
9 Views

gfortran isn't a subject of

gfortran isn't a subject of this forum, although Intel Fortran shares the relevant options.

I guess, by misspelling -mcmodel, the compiler may ignore that option.

As you named the executable "file," you would run it by ./file

0 Kudos
Highlighted
Beginner
9 Views

Thanks for your reply.

Thanks for your reply.

I also do this but I got No such file or directory error.

Is there any thing wrong with the compiling way?

0 Kudos
Highlighted
Beginner
9 Views

@ Tim:

@ Tim:

sorry I did not know here is not a good place to ask this question.

I typed it mcmodel in the terminal. Still no success.

 

0 Kudos
Highlighted
Beginner
9 Views

online@balm:~/group/Far

online@balm:~/group/Far/Fortran$ ./centroidmega-pimms2
-bash: ./centroidmega-pimms2: No such file or directory

0 Kudos
Highlighted
Employee
9 Views

We might be able to better

We might be able to better advise you if you capture and post the actual compilation line that you are using.

To compile and run the resulting executable you basically do something like what is shown below.

To compile with our Intel Fortran compiler (ifort) use:

$ ifort -o sample.exe sample.f90
$ ./sample.exe
 Testing 123....

To compile with gfortran, use:

$ gfortran -o sample.exe sample.f90
$ ./sample.exe
 Testing 123....

The -o option specifies the executable name.

0 Kudos