Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Mixed programming with Fortran77 and C

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
Highlighted
Valued Contributor II

gettim, getdat, and etime are

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
Highlighted
Beginner

Following your suggestion, I

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
Highlighted
Valued Contributor II

My guess would be that

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
Highlighted

I assume you were using some

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. 

Retired 12/31/2016
0 Kudos
Highlighted
Beginner

Thanks for all of your

Thanks for all of your suggestions.

0 Kudos
Highlighted
Beginner

Trouble again, why don't my

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

0 Kudos