Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Open watcom f77-Hello World

  1. Oct 9, 2011 #1
    Open watcom f77--Hello World

    Is there a document for watcom (fortran) f77 that uses the famous "Hello World" program through the steps of compiling it? Step by step. Illustrating the IDE, the editor, use of a target, compile.
     
  2. jcsd
  3. Oct 25, 2011 #2
    Re: Open watcom f77--Hello World

    I wrote an Open Watcom Fortran-77 "Hello World" Program, but I did not use the Open Watcom IDE.

    Assuming Open Watcom Fortran-77 has been installed on your computer and properly setup you
    should be able to follow my detailed instructions for creating a "Hello World" program.



    >>>>>>>>>>>>>>>>>>>>>>>>>>> OPEN WATCOM TEXT EDITOR <<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Step 1: Start the Open Watcom Text Editor by Clicking the "Start" button and then
    click on "All Programs" then click on "Open Watcom Fortran" and then select "Text Editor".

    Step 2: Using the Open Watcom Text Editor, click on "File" and select "New".

    Step 3: Click on "File" and select "Save As"

    Step 4: Provide a name for your program (Hello.For).

    Step 5: Choose "Fortran Files" from the "Save As Type" Drop Down.

    Step 6: Click on the "Save" button.

    Step 7: Copy the following program below into your "Open Watcom Text Editor":

    1. ****************************************************************** ​
    2. ** AUTHOR: SAM MANIOTES ​
    3. ** PROGRAM: HELLO.FOR ​
    4. ** DATE: 10/25/2011 ​
    5. ** LANGUAGE: OPEN WATCOM FORTRAN-77 ​
    6. ** DESCRIPTION: This program displays the words "Hello World" in a windows dialog box. ​
    7. ****************************************************************** ​
    8. ** ​
    9. *$include winapi.fi ​
    10. *$noreference ​
    11. INTEGER*2 FUNCTION FWINMAIN( hInstance, hPrevInstance, ​
    12. & lpszCmdLine, nCmdShow) ​
    13. *$reference ​
    14. IMPLICIT NONE ​
    15. INTEGER*2 hInstance, hPrevInstance, nCmdShow​
    16. INTEGER*4 lpszCmdLine ​
    17. include 'windows.fi' ​
    18. CHARACTER*11 FORM ​
    19. CHARACTER*80 BUFFER ​
    20. PARAMETER (FORM='(A,I5,A,I5)') ​
    21. WRITE(BUFFER, FORM) 'Hello World!!!'​
    22. CALL MessageBox( 0, BUFFER, ​
    23. & 'Sam Maniotes - Open Watcom Fortran-77'c,​
    24. & MB_OK .OR. MB_TASKMODAL )​
    25. end ​
    ********************************************************************************

    ***NOTE: Remember the Fortran-77 Continue Statements must begin in Column 6,
    and Continue Statements start with the ampersand (&) Character.

    Step 8: Click on "File" and then select "Save", to save your program.

    Step 9: Click on "File" and then select "Exit" to exit the Text Editor.

    ***NOTE: You could download the program from the "hello.txt" file I attached below and rename it to "hello.for".


    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> NOTEPAD <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Step 10: Using Notepad copy the following commands:



    wfl386 -l=win386 hello.for
    wbind hello -n



    Step 11: Click on "File" and then select "Save As" and name the file "Make.Bat".

    ***Note: Save this file in the same location as your "Hello World" (Hello.For) program is located.

    Step 12: Click on the "Save" button

    Step 13: Click on "File" and the select "Exit" to exit Notepad.

    ***NOTE: You could just download the file "make.txt", that I attached below and rename it to "make.bat".



    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MAKE HELLO WORLD <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Step 14: Using Windows Explorer navigate to the location of your "Hello World" program and double click on the "Make.Bat" file.

    Step 15: After the "Make.Bat" script executes, you should notice a "hello.exe" file in the same location as your "Hello World" Fortran program.

    Step 16: Double Click on the "Hello.exe" file, and you should notice a Windows Dialog Box display with the words "Hello World!!!" inside of it.

    I hope this helps...
     

    Attached Files:

  4. Nov 2, 2011 #3
    Re: Open watcom f77--Hello World

    Nicely done. I did write a Hello World program with the IDE, and executed it. I find the doc for the IDE a bit odd. Muliple targets? They barely mention command line ops. The whole thing looks incomplete. Then overall, they have no Help on the IDE. One must dig it out of the hlp files in the binnt folder.

    Recently, I decided to see if I could make a library. I couldn't work it out in the IDE, so happened to notice through ftools.hlp that OW f77 is loaded with command line ops. It got stuck on a 3033 error when I tried building the lib. From a msg on the web, it appears that it is in error. I'm not quite sure it's fixed. It's beginning to look as though the IDE may not be all that useful.

    I'm not that up to date on f77. It's been decades since I used ftn, but it looks like you might have created a window to put "Hello, World" in? If so, where do I find out more about that?

    I've just discovered wfl386 and a few other cmds. I'd prefer not to use the command line
    approach, but it may be inevitable.

    Are there any other freebie Win fortran compilers out there?
     
  5. Jul 1, 2012 #4
    Re: Open watcom f77--Hello World

    I gave this a try but get a bunch of errors. Maybe things have changed since 2011 or maybe there is some path I have to setup. Can someone please advise me?

    c:\temp>make

    c:\temp>wfl386 -l=win386 hello.for
    Open Watcom F77/32 Compile and Link Utility Version 1.9
    Portions Copyright (c) 1990-2002 Sybase, Inc. All Rights Reserved.
    Source code is available under the Sybase Open Watcom Public License.
    See http://www.openwatcom.org/ for details.
    wfc386 hello.for
    Open Watcom FORTRAN 77/32 Optimizing Compiler Version 1.9
    Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
    Source code is available under the Sybase Open Watcom Public License.
    See http://www.openwatcom.org/ for details.
    hello.for(9): *ERR* SM-02 error opening file winapi.fi - No such file or direct
    ory
    hello.for(17): *ERR* SM-02 error opening file windows.fi - No such file or dire
    ctory
    hello.for(23): *ERR* TY-06 column 7, type of MB_OK has not been declared
    hello.for(24): *ERR* TY-06 column 18, type of MB_TASKMODAL has not been declare
    d
    hello.for: *WRN* VA-07 in FWINMAIN, MB_TASKMODAL has been used but not defined
    hello.for: *WRN* VA-07 in FWINMAIN, MB_OK has been used but not defined
    hello.for: 11 statements, 0 bytes, 7 extensions, 2 warnings, 4 errors
    Error: Compiler returned a bad status compiling 'hello.for'

    c:\temp>wbind hello -n
    'wbind' is not recognized as an internal or external command,
    operable program or batch file.

    c:\temp>
     
  6. Jul 3, 2012 #5
    Re: Open watcom f77--Hello World

    You need to have the WFL386 environment variables declared. They can be used to specify commonly used WFL options.

    Example:
    C:\> set wfl=/d1 /ot
    C:\> set wfl386=/dl /ot

    The above example defines the default options to be "d1" (include line number debugging information in the object file),
    and "ot" (time optimizations over size optimizations).

    Once the appropriate environment variable has been defined, those options listed become the default each time the WFL or WFL386 command is used.

    You will also need to include the SOURCE folder of your program and Windows Libraries:
    C:\>set finclude=c:\watcom\src\fortran\dos;c:\WATCOM\LIB386\DOS;C:\WATCOM\LIB386\WIN

    Use the "System" icon in the Control Panel to define Environment Variables.

    If you are still having problems getting your program to compile, please try reading the Open Watcom FORTRAN 77 - User's Guide ftp://openwatcom.mirrors.pair.com/manuals/current/fuguide.pdf

    Let me know if you are still having problems getting your environment setup.

    Yours truly,

    Sam Maniotes
     
    Last edited: Jul 3, 2012
  7. Jul 3, 2012 #6
    Re: Open watcom f77--Hello World

    Thanks, I'll give that a shot.

    Unrelated ... how do I create a new post? I am logged in but don't see a link for "new post".
     
  8. Jul 3, 2012 #7

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    Re: Open watcom f77--Hello World

    Go to the page that shows the list of threads in a subforum. There is a "new thread" button near the top of that page.

    You can't start a new thread while you are viewing the posts in an existing thread (i,e. from the page where you looking at right now).
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Open watcom f77-Hello World
  1. F77 error (Replies: 3)

Loading...