error LNK2019: unresolved external symbol

error LNK2019: unresolved external symbol

Hello,

  I am woking on a fortran code. The code makes a reference to a file named netcdf.inc, which contains the definitions of several variables to be used in the main program. This netcdf.inc file is part of the build Resource files, and yet when I try compiling I get the error "LNK2019: unresolved external symbol" for every single variable that is defined in netcdf.inc and is referenced in the main code. I am kind of new to this so I would appreciate any guidance on why this may be happening - I've tried including the various variables within the main code and forego the whole "include netcdf.inc" to see if that was the problem, but that didn't fix the bug. Within the 'netcdf.inc' file, the variables are defined like this:

   integer         nf_create
   external        nf_create

For each of them. Not sure if that helps. I'm attaching a screenshot of my workspace. Thank you!

Carlos Oropeza

附件尺寸
下载 netcdf-workspace.jpg385.04 KB
9 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Netcdf typically requires that you first build and install the netcdf library, then set an environment variable which sets linker search path (or  take advantage of the linker dependencies VS project setup option).

There was a lengthy discussion at http://software.intel.com/en-us/forums/topic/281318 which is easlly found by normal search tactics.

Carlos,

Note that in Fortran "defined" has a definite meaning, which is not the same as "declared". The lines from the include file that you showed DO NOT define symbols/variables such as nf_create. They simply provide attributes (such as INTEGER and EXTERNAL) to the compiler so that it can emit correct code.

You are probably not including a NetCDF library at link time -- a library in which the actual executable code for the integer function nf_create is contained.

Hi,

I have just started ivf 11.1.051. I have a problem in linking libraries. After collecting all libraries I know, I still have the error "libirc.lib(tbk_backtrack.obj): LNK 2019: Unresolved external symbol _imp_xxxxxxxxx referenced in function tbk_trace_stack". This message repeats for imp_SymInitialize, imp_StackWalk64, and imp_SymCleanup.

Best regards.

Prof. Dr, Said El Noshokaty 

Such references from libirc.lib should be taken care of automatically in a normal installation of ifort, using ifort to complete the link step.  The compiler normally would choose libircmt.lib which should satisfy such references itself.  If I remember correctly, non-thread-safe linking was last supported with VS2005 (32-bit).

Those symbols should be resolved by linking against dbghelp.lib. This is a Windows library that should be automatically pulled in. Perhaps you are doing your build in a way that prevents this.

I will also comment that 11.1.051 is four years old.

Steve - Intel Developer Support

Hi Tim,

Hi Steve,

Thank you for help. 

'libircmt.lib' is not selected by ifort. 'libcmt' is selected instead. Command-line ifort is installed with 'no vs shell' option. OS is Win 7 professional (64-bit), updated by Windows platform SDK.

Linking against dbghelp.lib results in same error.

Best regards.

Prof. Dr, Said El Noshokaty 

Please set the project property Linker > General > Show Progress Messages to Show All Progress Messages. Do a rebuild of the project and then attach a ZIP of the buildlog.htm from the Debug or Release folder to a reply here. This may give us a clue.

Steve - Intel Developer Support

Hi Steve,

Linking against x64 version of ImageHlp.lib and Uuid.lib results in no errors. Thank you for your support.

Best regards.

Prof. Dr, Said El Noshokaty 

发表评论

登录添加评论。还不是成员?立即加入