0

I tried to use a library about date time conversion in this website. However, when compiling it, errors occur:

ERROR   1    error LNK2019:     mod_datetime.obj    
ERROR   2    error LNK2019:     libifcoremdd.lib(for_main.obj)  
ERROR   3    fatal error LNK1120: 2 x64\Debug\datetime.exe  

There are some similar questions (this or this), but they seems not about this "libifcoremdd.lib" problem. I find libifcoremdd.lib in my computer(C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\ia32 and C:\Program Files (x86)\Intel\Composer XE 2013 SP1\compiler\lib\intel64), why the link process failed?

T X
  • 505
  • 1
  • 9
  • 19
  • You haven't given the complete text of the error messages. LNK2019 is "unresolved reference" and the message should have included the name of the symbol it was looking for. I will guess that in ERROR 2, it was unable to find `_MAIN__` or the main program, probably because you tried to build as an executable a source that did not contain a Fortran main program. If this is indeed a library, you want to choose the "static library" project type or use appropriate commands on the command line to build a static library. We need more info on ERROR 1. – Steve Lionel Sep 21 '19 at 21:15
  • @SteveLionel Thanks, it is because it's a library, and I need to choose the "static library" project type – T X Sep 22 '19 at 01:25

1 Answers1

0

Expanding on a comment I gave above - the quoted error text omits crucial pieces of information, that being the names of the symbols the linker was unable to find. (LNK2019 is "unresolved reference"). While it's unclear what ERROR 1 is referring to, ERROR 2 is due to your taking the library sources and building them in an executable project type. This causes the linker to look for a symbol _MAIN__ (for 32-bit) that is the Fortran main program. If there is none, then you'll get a LNK2019 error naming for_main.obj in the Intel Fortran run-time library.

The solution is to create a new project in Visual Studio of the "Fortran Static Library" type, so that a main program is not expected.

Steve Lionel
  • 6,972
  • 18
  • 31