Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
27224 Discussions

INTERFACE - Compile Error #5082: found END-OF-FILE - Intel 19.0 Update 3 64 for VS 2017

Mark_P
Beginner
363 Views

Hello Intel Community, 

 

I am facing an interesting problem when attempting to compile couple of routines to create .dlls which are to be used by the Ansys FE software. 

Currently, we are trying to compile a simple example of a user-material subroutine (fsimple.f attached) which has an INCLUDE statement for neml_interface.f (attached). For more information on the origin of this example, refer to the open source code here https://github.com/Argonne-National-Laboratory/neml/tree/dev/util/f_interface. The NEML libraries were built following the instructions here: https://neml.readthedocs.io/en/dev/install/windows.html

When invoking (local machine is Win 10, Intel Compiler 2019 Update 3, VS v15.0.2..)

ifort fsimple.f neml_interface.f

 in Intel shell, the following error emerges

neml_interface.f(78): error #5082: Syntax error, found END-OF-FILE when expecting one of: <LABEL> <END-OF-STATEMENT> ; <IDENTIFIER> TYPE MODULE ELEMENTAL IMPURE NON_RECURSIVE ...
      end interface
-------------------^
compilation aborted for neml_interface.f (code 1)

The same happens when attempting to compile the purpose-built user-material source code and attempting to link it to Ansys by calling Ansys-specific .bat file which builds the dlls (this batch file virtually defines machine/compiler settings and issues ifort commands etc). 

The issue is puzzling because other collaborators have shared that the sample test code above, as well as the user-material Ansys routines,  compile and build dlls without facing issues with the INTERFACE block on other Windows setups (e.g Win 10, Intel API 2020+, VS 2019). Any feedback would be greatly appreciated! 

Many thanks, 

M

0 Kudos
1 Solution
mecej4
Black Belt
330 Views

A better solution, instead including the file with the interface blocks in every place where those interfaces are needed, is to put the interfaces inside a module, and add a USE statement for that module where needed.

Regarding the unresolved external symbols, please note that providing interfaces only gives the compiler information regarding what argument types are expected, etc.; in other words, the interface. You still need to provide (in an OBJ or LIB file) the implementations of those routines. Whether these implementations are provided by Ansys, you or a fourth party, I cannot tell. You will have to obtain that information elsewhere.

The topic of interfaces, implementations, etc., is the topic of Fortran books and tutorials, of which many are available on the Web and easily found using a search engine.

View solution in original post

4 Replies
mecej4
Black Belt
346 Views

The explanation is quite simple. The source file neml_interface.f contains just an interface block, which is not quite a complete and compilable program unit. In fact, your fsimple.f contains an include statement for neml_interface.f.

You would be better off by naming a source file containing a code section that is meant to be included in another source file with a ".inc" suffix rather than a ".f" or ".f90" suffix. Alternatively, configure your project so that neml_interface.f is not regarded as a self-contained Fortran source file and a compilation attempted.

Mark_P
Beginner
337 Views

Thanks for the info, mecej4. For the second option, would that mean placing the INTERFACE block inside the fsimple.f program? When I do that, error LNK2019: unresolved external symbol appears for al the functions/subroutines inside the INTERFACE block.

 

Would you be able to provide more info on the .inc file option ? Thanks in advance!

mecej4
Black Belt
331 Views

A better solution, instead including the file with the interface blocks in every place where those interfaces are needed, is to put the interfaces inside a module, and add a USE statement for that module where needed.

Regarding the unresolved external symbols, please note that providing interfaces only gives the compiler information regarding what argument types are expected, etc.; in other words, the interface. You still need to provide (in an OBJ or LIB file) the implementations of those routines. Whether these implementations are provided by Ansys, you or a fourth party, I cannot tell. You will have to obtain that information elsewhere.

The topic of interfaces, implementations, etc., is the topic of Fortran books and tutorials, of which many are available on the Web and easily found using a search engine.

Mark_P
Beginner
325 Views

Thank you mecej4. I will explore the module and use option. Much appreciated!

Reply