Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28381 Discussions

Mixed programming with Fortran77 and C

Intel_C_18
Beginner
437 Views

Dear Steve,

I am making a project with C and F77 and the main program is written by F77. During build my code, I was trouble about errors as follows. There was no such error in my previous project written only by F77.

1>atemp.obj : error LNK2001: unresolved external symbol etime
1>banner.obj : error LNK2001: unresolved external symbol getdat
1>dyn4.obj : error LNK2001: unresolved external symbol gettim
1>Diglib.lib(gdhpdj.obj) : error LNK2001: unresolved external symbol tiffpak
 fatal error LNK1120: 4 unresolved externals

But I am sure about that subroutines etime, getdat and gettim are included in fortran77 library. 

Platform: 

Intel® Parallel Studio XE 2016 Update 2 Composer Edition for Fortran Windows* Integration for Microsoft Visual Studio* 2015, Version 16.0.0061.14

0 Kudos
6 Replies
andrew_4619
Honored Contributor II
437 Views

gettim, getdat, and etime are in the fortran portability module so you should have "USE IFPORT" in your source

I don't know tiffpak I guess this is some third part libary you need to include in the linking

 

0 Kudos
Intel_C_18
Beginner
437 Views

Following both of your suggestions, I passed the build. Thank you very much. But there was no such error in my previous f77 project without "use ifport". Why?

0 Kudos
Arjen_Markus
Honored Contributor I
437 Views

My guess would be that tiffpak has to do with TIFF files. But could the problem be caused by a change in name mangling/calling convention? Of old, Compaq Visual Fortran used the stdcall convention (as did a lot of libraries) and that meant that the routine names were in capitals with the number of bytes in the argument list appended.

Try setting the calling convention to "stdcall". This might solve the issue with tiffpak.

0 Kudos
Steven_L_Intel1
Employee
437 Views

I assume you were using some other compiler earlier. None of those routines are part of the Fortran language.  Since you're posting on the Windows forum, I note that you are probably using /names:lowercase to make up for some other nonportable assumptions in your program. With that, the external names for ETIME, GETDAT and GETTIM are inconsistent with those we provide in the portability library. Adding USE IFPORT explicitly declares these routines with the correct external name so that the link errors go away.

tiffpak is something else entirely. Again, it's nonportable assumptions about names. 

0 Kudos
Intel_C_18
Beginner
437 Views

Thanks for all of your suggestions.

0 Kudos
Intel_C_18
Beginner
437 Views

Trouble again, why don't my program pause at F9 breakpoints with F5 debug?

0 Kudos
Reply