Topic: Having problems with the logic of SF

It's been a while...I only do some programs every 6 months or so.  But I can't seem to understand the logical steps in creating the project, building, and running my program.  I have written my code, I've saved the code to a file with a FOR extension, I've created a project with a PRJ extension.  But when I try and generate a Makefile or try and Build it, I get a "Make Construction Error".  I don't see a way to upload an screen shot.

Since I come back to SF so infrequently, I can't seem to figure out what the basic steps are anymore.  For some reason, it's just not intuitive to me.

Thanks for any help...Kurt

2 (edited by JohnWasilewski 2013-03-14 14:32:40)

Re: Having problems with the logic of SF

Have you 'added' your source file to the project?
RIGHT-CLICK the project name in project outline.

Re: Having problems with the logic of SF

I believe so.  When I double-click on my .FOR file, SF runs and the project outline shows "Untitled (project exe)".  Strange in that my source code shows in the pane to the right.  I then right-click on the untitled project, go to File and Open Project...I select "D-1Deadband.PRJ" and then "Untitled" changes to "D-1Deadband (project.exe)".  But if I try and perform a makefile, I continue to get the makefile construction error.

Kurt

Re: Having problems with the logic of SF

Well, I got things to work.  I right clicked on the project name (D-1Deadband) and added a file which was the original .FOR file.  I have been able to build and run the program.

I really don't understand this logic...I double-click on my FOR file, SF opens, and the code shows in the right pane.  Then I have to add the file...again...to the project.

Just not intuitive for me...Kurt

5 (edited by JohnWasilewski 2013-03-15 08:34:26)

Re: Having problems with the logic of SF

To edit source code, compile, link and run, you have to open a PROJECT not just a Fortran source file.
A simple project, or even a complex one with everything in one long source file, can contain just the one source file.
In more advanced (or better organised) projects, there will typically be a number of separate source files, plus library files.  All of these are added to the project in the same way.

Any file can be opened for editing without adding it to the project.

When you launch SF by double-clicking on a .FOR file, invoking SF and having SF open the file and display it, you are opening the file in the SF editor, not opening it as part of a SF project.  To open a SF project ready to compile or run, double click a .PRJ file.

You can also, from within SF, open source files in other projects, to view them, copy stuff from them or amend them, all without adding to the current project.  You can open data files and output files.

You can create a new file in the SF editor, and save it.  This is very useful for creating data input files, for example.
A file doesn't become part of the project until you say so.

When you want a source file to be part of the project, you have to say so !

NB don't forget to use the Options menu to set some project options.

Recommended:  Create a project, not by double clicking a .FOR file in Windows, but by opening SF and choosing one of the startup-screen options, then adding a source file.  This way, you'll get all the right default settings in options.
--
John

Re: Having problems with the logic of SF

John -

That's what I finally figured out...open a PRJ file first.  On the left side pane, there is a source file associated with the project, so I click on that (or double-click, not sure) and the editor opens up.  Then I'm off and running.

I'm used to dealing with one FOR file at a time for any given engineering "project".  Of course I write multiple FOR files that might be associated with one of my engineering projects, but I don't think of the different source files as part of a SF project.

Let me ask this...let's say I have an SF PRJ "wingstress".  Can I have multiple source files attached to this project as shown in the left-hand pane?  If I open one of those source files into the editor, make some changes, then save-build-run, will it only run that one source file and leave all the others alone?  This may be what's confusing me or I'm not understanding.  Currently, for each source file, I have its own PRJ file.

Thanks...Kurt

7 (edited by JohnWasilewski 2013-03-21 09:17:02)

Re: Having problems with the logic of SF

You can put all your source code in one source file, or have a set of source files, one for each subroutine, OR you can do a bit of both.  SF reads them all and looks inside the code to see what it does and where it belongs, then works out how to compile and link it all together.

You can also add binary files to a project in exactly the same way as you add a source file.  If it is, for example, a fully compiled and bundled library, then SF sees that it is, and doesn't try to compile it, but links from it, pulling in only the routines actually needed from it.  I think this is what happens, but Jeff will no doubt correct me if necessary.
---
John

Re: Having problems with the logic of SF

1. open a SF blank page.
2. Change the name of 'Untitled(Project.exe)' to anything you like.
3. Save the project with *.prj.
4. add folder or file to your project by right click on 'Untitled(Project.exe) or your new name.
5. when adding folder, there is no need to have extention.
6. while creating file, i normally use the extention of f90. for example; *.f90.
7. right down your codes in the proper file.
8. build the project.
9. run it.
10. after any change through you codes, remember you should save and build it again.

Re: Having problems with the logic of SF

To be more specific, I'd like to attach an image but don't see how to do that...I'll use ASCII code to illustrate.  I have the PRJ file open and there are two files under the project.  In actuality, these two files are separate, independent FOR files....I currently have separate PRJ files for them.  But for the purposes of my questions, I put both files in the same project.  Can I run the top FOR file without the second FOR being used?  Or just the fact that both FOR files are shown together, does SF assume they're connected?

D-1Deadband (project.exe)
  |
  ----D-1Deadband.for
  |
  ----D-1PeakP.for

Kurt

Re: Having problems with the logic of SF

Kurt,

You can "Disable" files by right-clicking on a file in your project tree and selecting "Disable File."  It should now appear with a red X through the icon in the tree.  Disabling the file will instruct Simply Fortran to ignore it during compilation procedures.

You can of course have more than one Fortran file in a project because most Fortran projects will be composed of multiple source files.  The real restriction will be that there can only be one "program" in a project.  If two files both have "program" definitions, compilation will fail (unless one of the files containing a program definition is disabled, as explained above).  However, if one has a program and another has a collection of subroutines, functions, or modules, everything will be fine (with certain restrictions, of course).

Jeff Armstrong
Approximatrix, LLC

Re: Having problems with the logic of SF

Jeff -

Thanks...I'll stick to one PRJ for each FOR I write.  Simple logic, for a simple mind!!

Kurt