- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm new to Fortran, and trying to port F77 code to Visual Fortran latest edition. I have a file that simply defines variables and puts them in a COMMON block. This file does nothing else and it is included in a bunch of other source files. No matter what is in this file, the compiler keeps giving me an error: "There are multiple unnamed main program declarations in this file". I tried deleting the file and started from scratch, and I only put one variable definition in there followed by the keyword "END". No matter what I try I still get the same error. This error is followed by a warning: "Warning: Program may contain only one main entry routine". None of this makes any sense to me. What is an unnamed main program declaration? What is a main entry routine? This file doesn't have any routines in it! Thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since I don't know what your file looks like, I can't be sure as to what the problem is, but I am fairly certain that you have named your INCLUDE file with a .F, .FOR or .F90 file type and have added it to the list of project files. Click on the name(s) of your Include file(s) in the project files list and press Delete. Only compilable files should be in this list - INCLUDE files will show up under External Dependencies.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
While Steve may have touched the root of your problem (i.e. the reason why you put the keyword "END" at the end of your include file -- the compiler likely initially warned you about the include file being invalid code and then you "fixed" this by inserting "END" at the end of your include file, right?) after following his advice, you now must also remove the END line from the end of your include file. As it is, you are putting an END line in the middle of every program unit that INCLUDEs your file and that ends the current program unit. Since the code that follows doesn't start with a FUNCTION, SUBROUTINE, MODULE, or BLOCKDATA statement it is considered by the standard to be the start of a PROGRAM. Everywhere you include the file with the END line in it you are starting a new PROGRAM and this is what the compiler is complaining about.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page