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

$' is not recognized as an internal or external command, operable program or batch file

Jump to solution

Hi

 

I tried to compile my codes with commanding  "$ ifort -o Weibull Weibull.for", but it gave me an error that 

'$' is not recognized as an internal or external command,
operable program or batch file.

 

$ should be used right?

Thank you

0 Kudos

Accepted Solutions
Highlighted
Retired Employee
6 Views

Yanmei,

You can use the command line, but you have to set up the compiler environment. Intel installs shortcuts that do it for you as I showed above. You can also use the compiler from a command prompt you started some other way (cmd.exe, etc.) but first must type the command:

call "%IFORT_COMPILER20%bin\ipsxe-comp-vars.bat" intel64

This assumes you have the current version. Replace 20 with 19 for the 2019 version, etc.

Now to your code. I am going to guess that you stayed with calling the program Weibull.for, which makes it fixed-form source (read the Doctor Fortran article I linked to above.) The only line you have where that matters is the FORMAT line. In fixed-form source, statement labels (the 5) must be in columns 1-5. So you could move the 5 into column 1, making sure the word "format" is in column 7 or higher. The alternative, which I would recommend, is to rename the file Weilbull.f90, in which case it will compile as it is.

I see one error in your code, though. You have:

read*,Elem_array

twice. I think the second time you want to read into Ts_array.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran

View solution in original post

0 Kudos
10 Replies
Highlighted
Retired Employee
6 Views

No, don't use $. $ is a

Jump to solution

No, don't use $. $ is a command processor prompt used by some shells on Linux systems, but that was a Windows error message. If you saw it in an example, it was meant to represent the prompt, not something to type.

I would also suggest that you're reading instructions for a non-Windows system. The command you wrote would be accepted, but probably doesn't do what you intend. On Windows use:

ifort Weibull.for

You don't need any other options - the executable will be named Weibull.exe.

If this is a program you wrote, may I strongly suggest that you learn about free-form source and use that for your code rather than fixed-form? (See Doctor Fortran in “Source Form Just Wants to be Free”) .for as a file type indicates fixed-form.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
6 Views

Hi Steve,

Jump to solution

Hi Steve,

Thank you so much for the explanation. I tried 

ifort Weibull.for 

it turns out that 

'ifort' is not recognized as an internal or external command,
operable program or batch file.

Is there anything wrong with my system?

Yanmei

0 Kudos
Highlighted
Retired Employee
6 Views

How are you getting to the

Jump to solution

How are you getting to the command prompt? Use Start > Intel Parallel Studio XE 20xx > Compiler 1x.x for Intel 64 ... (select the option that seems best for you.)

Note that this will set you up in a default directory you can't use, so you would need to "cd" to a writable directory. What I like to do is copy one of those shortcuts to my desktop and change the properties so that the shortcut is (for example):

C:\Windows\System32\cmd.exe /E:ON /V:ON /K ""%IFORT_COMPILER20%bin\ipsxe-comp-vars.bat" intel64 vs2019"

and the Start in is my projects folder.

IFORT_COMPILER20 is for the Compiler XE 2020 product - change this to IFORT_COMPILER19 for 2019, etc.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
6 Views

Hi Steve,

Jump to solution

Hi Steve,

I found that I need to use Intel Composer Intel Visual studio instead of cmd.exe.

Now I have another problem, that I need to read two text files and write them in a file. I wrote it as below. The  label of the format statement which I use as 5, seems to be wrong.

        PROGRAM Weibull

       INTEGER Elem_array(33)

       REAL Ts_array(33)

        open (unit=12, file="Elem_array")

        read*,Elem_array

        open (unit=12, file="Ts_array")

        read*,Elem_array

        do 33 i =1,33

              write(*,5), (Element(i),Ts_array(i))

              5 format (I8,F10.5)

        end do

        close(12)

        end

 

Thank you

0 Kudos
Highlighted
Retired Employee
7 Views

Yanmei,

You can use the command line, but you have to set up the compiler environment. Intel installs shortcuts that do it for you as I showed above. You can also use the compiler from a command prompt you started some other way (cmd.exe, etc.) but first must type the command:

call "%IFORT_COMPILER20%bin\ipsxe-comp-vars.bat" intel64

This assumes you have the current version. Replace 20 with 19 for the 2019 version, etc.

Now to your code. I am going to guess that you stayed with calling the program Weibull.for, which makes it fixed-form source (read the Doctor Fortran article I linked to above.) The only line you have where that matters is the FORMAT line. In fixed-form source, statement labels (the 5) must be in columns 1-5. So you could move the 5 into column 1, making sure the word "format" is in column 7 or higher. The alternative, which I would recommend, is to rename the file Weilbull.f90, in which case it will compile as it is.

I see one error in your code, though. You have:

read*,Elem_array

twice. I think the second time you want to read into Ts_array.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran

View solution in original post

0 Kudos
Highlighted
Black Belt
6 Views

Unit 12 is opened twice in

Jump to solution

Unit 12 is opened twice in the program with no CLOSE in between, and no I/O is done on that unit. That is probably an error, and the READ statements probably were meant to read from unit 12.

The I/O list in the WRITE statement has an extra pair of parentheses.

0 Kudos
Highlighted
Beginner
6 Views

Hi Steve,

Jump to solution

Hi Steve,

 

Thank yo for details. I have compiled the code, and get an application and an objective file. However, the .exe is empty if it is open, and will automatically disappear if I type anything. I think there is still problems. Could you please have a look? Thank yo very much!

 

 

0 Kudos
Highlighted
Black Belt
6 Views

Your program is only 14 lines

Jump to solution

Your program is only 14 lines long, and it would be beneficial to you to examine the program critically and assure yourself that the program will accomplish what you wanted it to do.

The program of #8 opens two formatted files, but does nothing useful with them. (I commented on this problem in #7, but you seem to have ignored those comments.)

Instead of reading those files, your program would read from the console, reading an array of 33 integers twice. If the console input that you provide does not match, the program may abort, but you may not see the error messages because those messages are output to a new window and the window gets closed in such a short time that you may not even notice that it ever existed.

Array Ts_array is never initialized, yet you attempt to output the values in the array. You can only expect junk output for that.

0 Kudos
Highlighted
Retired Employee
6 Views

Some comments...

Jump to solution

Some comments...

Opening the same unit with different files does what you want - it implicitly closes the previous one - but I hate this feature of the language ("OPEN on a connected unit"). I see you changed that in your later file and am glad you did so. However, you haven't fixed the problem that you read into Elem_array twice when you meant to read intio Ts_array after opening the second file.

The reason the output disappears is that when, in Visual Studio, you tell it to "start debugging" and have not set any breakpoints, the output window closes when the program exits. If you select "Start without debugging", the window will stay around until you tell it to close.

 

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
6 Views

Hi Steve,

Jump to solution

Hi Steve,

 

Thank you for the help, the problems are solved! You are really helpful!

 

Yanmei

0 Kudos