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

Link problem with a Fortran static library from VC++

as
Beginner
662 Views
Hi all,

I'm having trouble to link a VC++ 7.1 project with a static Fortran library compiled with IVF 9.

The whole project is ported from VC++ 6 & CVF 6.1, where all f90 and cpp files where mixed up in the same project.

When recompiling the new project I got the following output messages:

thermozns.lib(wrapper.obj) : error LNK2019: symbole externe non rsolu _for_cpystr rfrenc dans la fonction _thmzns
thermozns.lib(report.obj) : error LNK2019: symbole externe non rsolu _for_write_seq_lis rfrenc dans la fonction _report
thermozns.lib(dupl0001.obj) : error LNK2019: symbole externe non rsolu _for_write_seq_lis rfrenc dans la fonction _thermo_zns
thermozns.lib(wrtrxn.obj) : error LNK2019: symbole externe non rsolu _for_write_seq_lis rfrenc dans la fonction _wrtrxn
thermozns.lib(H2O92.obj) : error LNK2019: symbole externe non rsolu _for_write_seq_lis rfrenc dans la fonction _h2o92

These 'French' messages could be translated as:
thermozns.lib(***.obj) : error LNK2019: external symbol _for_****** refrenced in function _***

What's I'm missing ?

Thank you for help
0 Kudos
4 Replies
TimP
Honored Contributor III
662 Views
It still appears that you are not linking against the Fortran run-time libraries which come with the compiler used to build the .obj. Unless you used ifort as the linking command, this would require you to specify the library path and libraries.
0 Kudos
as
Beginner
662 Views
Sorry I'm new to Intel Fortran ...
Even after I link to run time libraries in VC++ paths, the following link errors still appear:
dition des liens en cours...
libifcoremt.lib(for_io_util.obj) : error LNK2019: symbole externe non rsolu __pctype rfrenc dans la fonction _for__get_number_value
libifcoremt.lib(tbk_traceback.obj) : error LNK2001: symbole externe non rsolu __pctype
libifcoremt.lib(for_io_util.obj) : error LNK2019: symbole externe non rsolu ___mb_cur_max rfrenc dans la fonction _for__get_number_value
libifcoremt.lib(tbk_traceback.obj) : error LNK2001: symbole externe non rsolu ___mb_cur_max
libifcoremt.lib(for_init.obj) : error LNK2019: symbole externe non rsolu ___argc rfrenc dans la fonction _for_rtl_init_
libifcoremt.lib(for_init.obj) : error LNK2019: symbole externe non rsolu ___argv rfrenc dans la fonction _for_rtl_init_
./bin/GdbExplorer.exe : fatal error LNK1120: 4 externes non rsolus

Any help??
0 Kudos
Jugoslav_Dujic
Valued Contributor II
662 Views
These symbols are from C RTL (libc*.lib)??? Did you perhaps add /ignore switch somewhere? If you did - remove it please.

If you still cannot sort it out, please post your compiler/linker settings (vfproj and vcproj files are fine).

/verbose switch (on linker settings) will tell you which libraries are searched and why - libc*.lib has to be one.

Jugoslav
0 Kudos
as
Beginner
662 Views
Thanks, it works ... by using /verbose i found that the problem is that I was linking my C++ program against an MFC based library as "shared MFC library" i.e. a DLL, while my Fortran library was compiled as static. This created a double reference to the C RTL.

I linked against a static MFC library version, and it gone smoothly.

cheers
0 Kudos
Reply