0
votes

I am using Intel Visual Fortran Composer XE 2011 to build my Fortran project in MS Visual Studio 2008. I am getting linker errors: LNK2019 unresolved external symbol.

I did a dumpbin on my obj files and all of my symbols (under CVF calling convention) are exporting as _symbol1, _symbol2, _symbol3, and so on EXCEPT for three random ones that have some stuff prefixed to it.

For example: _imp_symbol4, _imp_symbol5, _imp_symbol6

At first I suspected my calling convention must have been the problem but if it was my calling convention, wouldn't ALL of the other symbols have exported with the imp prefixed to it as well? It's so random that three of them export weirdly and I don't quite understand what is going on. Any help would be appreciated.

2
Does the error message tell you which symbols are the problem? If so, are those three the symbols that you are getting the linker error message for? Where are the routines that you are trying to link to? In the same or different source file? In a library? How are you telling Fortran about them? Are they in a module that you are "using"? - M. S. B.
yes it tells me which symbols are the problem and those symbols are the ones giving me the linker errors. The functions being used in my project are being called from a static lib which I have set the dependencies already. And they are all in the same source file. - user1496542

2 Answers

0
votes

The entities corresponding to those symbols may have the DLLIMPORT attribute. The link step may be missing the relevant import library.

0
votes

I found out the issue was because I had some DLL export statements for those symbols when I really didn't need them. It made the compiler expect _imp_sybmol because I was exporting them using the statement:

    !DEC$ATTRIBUTES STDCALL:: YOURSYMBOL
!DEC$ATTRIBUTES DLLEXPORT:: YOURSYMBOL

I just removed them and the linker errors went away.