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

Linking Fortran / C-C++

m_santos
Beginner
343 Views

Hi everybody,

I have a two-project solution: A C console programcalls a function in the a FORTRAN static library .The compiler (IV10.1) gave me the following errors. I'v never used those external symbols in the error messages anywhere in my fortran static library program. I tried a few thing, but it didn't fly. Do you have a clue of what happened? Anybody? Thanks a lot.

m.santos

0 Kudos
3 Replies
m_santos
Beginner
343 Views

2>sic10ctr.obj : error LNK2019: unresolved external symbol _FSUBC referenced in function _executeController

2>sic10ctr.obj : error LNK2019: unresolved external symbol _GETVARFROMDAT referenced in function _getPj

2>D:RLU32_newcmvu32_2Debugcmvu32_2.exe : fatal error LNK1120: 2 unresolved externals

0 Kudos
Jugoslav_Dujic
Valued Contributor II
343 Views
The linker is saying that it cannot find (probably expected-to-be Fortran) routines Fsubc and GetVarFromDat, which are referenced from (most likely C) functions executeController and getPj, both located in source file sic10ctr.c (or .cpp).
0 Kudos
Steve_Nuchia
New Contributor I
343 Views

For reasons that are not entirely obvious, IVF does not add its libraries to the C++ linker's search path. You need to add it, either for your C++ project or as a global setting. These options have different limitations.

If you add it to the project you have to deal with the fact that the path to the IVF libraries is not invariant: that are in Program Files on 32-bit operating systems and Program Files (x86) on 64-bit operating systems. The predefined macros used by IVF projects to locate these files are not exported to the C++ parameter framework.

On the other hand, global (Toolt -> options -> projects -> C++ Directories -> Libraries) settings have to be maintained per-machine, per-user, and per-platform (x64, win32, Itanium).

Yet another alternative is to copy the redistributables from the compiler into your source tree and add the folder containing them to your C++ project's "Additional Library Directories" setting. The downside to this is you have to keep your copy in sync with your FORTRAN compiler as you update it.

TANSTAAFL, friend.

-swn

0 Kudos
Reply