Topic: Unexpected end of file in compile

I have a large INCLUDE file that has declarations for a lot of variables in COMMON, as well as parameter definitions. When I try to compile the main program, which has the statement

INCLUDE 'QJCommons.F90'

The compiler gives the error:

==============================================================================
Generating Makefile... Okay
==============================================================================
Compiling .\qjcommons.f90
f951.exe: Error: Unexpected end of file in '.\qjcommons.f90'
Error(E42): Last command making (build\qjcommons.o) returned a bad status
Error(E02): Make execution terminated

* Failed *

What can be causing this? The file has correct syntax (at least the editor is not complaining).

Re: Unexpected end of file in compile

By default, Simply Fortran will try to compile all files with a valid Fortran extension (like .F90) as separate files, but, in your case, it shouldn't.  You'll need to right-click QJCommons.F90 in the Project Outline and select "Disable File" to make sure Simply Fortran doesn't attempt to compile it directly.  It will still be compiled properly when it is pulled in via INCLUDE statements in your other source files.

Let me know if the above works properly.

Jeff Armstrong
Approximatrix, LLC

Re: Unexpected end of file in compile

I don't know if this would make any difference but, when I use INCLUDE files, I give them the extension, '.INC' rather than one of the Fortran extensions like .F90, .FOR or  .F77 , which Fortran compilers generally take from filename and extension to mean they are Fortran source files, and are to be compiled.

I also don't include them in the Project Outline list, but just make sure SF knows where they are, so that statements like INCLUDE '{IncludeFIleName}.INC' can be executed at compile time.

I don't know what would happen if, as well as using a non-Fortran IncludeFileName extension, I also added these files to the Project Outline.
---
John

Re: Unexpected end of file in compile

John,

Simply Fortran should recognize files with a .INC extension as Fortran files for editing purposes.  However, it will not attempt to compile them directly during build.  They should be safe to include in the Project Outline.

Jeff Armstrong
Approximatrix, LLC