LNK2019: unresolved external symbol __imp__dclass - visual-studio

I am trying to build ffmpeg on visual studio for ARM architecture. I run into following linker errors:
Error 58 error LNK2019: unresolved external symbol __imp__dclass referenced in function mov_read_tkhd avformat.lib(mov.o)
Error 59 error LNK2001: unresolved external symbol __imp__dclass avformat.lib(thp.o)
Error 60 error LNK2001: unresolved external symbol __imp__dclass avutil.lib(rational.o)
Error 61 error LNK2001: unresolved external symbol __imp__dclass avutil.lib(eval.o)
What is __imp__dclass and where it is defined in Visual Studio / FFMPEG?
I get the following when I do "dumpbin /symbols mov.o"
22D 00000000 UNDEF notype External | __imp__dclass
Any ideas?

This particular issue was due to missing isnan and isinf methods in FFMPEG. There was a problem in bringing math.obj and float.obj dependencies.

Related

Visual Studio Cannot Find MPI Library

------------------UPDATE on 5/20/2019------------------
Following the suggestion by Gilles Gouaillardet, I have compiled my Fortran code with the /NODEFAULTLIB option. Now, I get fewer error messages:
Error 1 error LNK2019: unresolved external symbol __intel_new_feature_proc_init referenced in function MAIN__Test.obj
Error 2 error LNK2019: unresolved external symbol for_set_reentrancy referenced in function MAIN__ Test.obj
Error 3 error LNK2019: unresolved external symbol for_write_seq_lis referenced in function MAIN__ Test.obj
Error 4 error LNK2001: unresolved external symbol mainCRTStartup LINK
Error 5 error LNK2001: unresolved external symbol _fltused msmpifmc.lib(mpifbind.obj)
Error 6 fatal error LNK1120: 5 unresolved externals x64\Release\Hello.exe
Thank you.
------------------UPDATE on 5/17/2019------------------
So this is a response to the comment by Gilles Gouaillardet. This is only an update to my original question and not an answer.
My code is:
program mpisimple
implicit none
integer ierr
include 'mpif.h'
call mpi_init(ierr)
! print message to screen
write(6,*) 'Hello World!'
call mpi_finalize(ierr)
end
Just to recap, I am using Visual Studio 2012 and I have downloaded Microsoft-MPI v.10.0.
The following directories have been added to the "Additional Include Directories" for Fortran tab:
C:\Program Files (x86)\Microsoft SDKs\MPI\Include\x64
C:\Program Files (x86)\Microsoft SDKs\MPI\Include
The following directories have been added to the "Additional Library Directories" for Linker tab:
C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64
These two files have been added as the Additional Dependencies:
"msmpifmc.lib" "msmpi.lib" <- I also tried these without the quotation marks.
Now I am getting different errors, which have to do with things already defined elsewhere:
Error 1 error LNK2005: __crtSetUnhandledExceptionFilter already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(winapisupp.obj)
Error 2 error LNK2005: _calloc_crt already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(crtheap.obj)
Error 3 error LNK2005: _amsg_exit already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(crt0dat.obj)
Error 4 error LNK2005: _cexit already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(crt0dat.obj)
Error 5 error LNK2005: _exit already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(crt0dat.obj)
Error 6 error LNK2005: _initterm_e already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(crt0dat.obj)
Error 7 error LNK2005: exit already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(crt0dat.obj)
Error 8 error LNK2005: _lock already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(mlock.obj)
Error 9 error LNK2005: _unlock already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(mlock.obj)
Error 10 error LNK2005: _XcptFilter already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(winxfltr.obj)
Error 11 error LNK2005: _configthreadlocale already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(wsetloca.obj)
Error 12 error LNK2005: "void __cdecl terminate(void)" (?terminate##YAXXZ) already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(hooks.obj)
Error 13 error LNK2005: __xi_a already defined in MSVCRT.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj)
Error 14 error LNK2005: __xi_z already defined in MSVCRT.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj)
Error 15 error LNK2005: __xc_a already defined in MSVCRT.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj)
Error 16 error LNK2005: __xc_z already defined in MSVCRT.lib(cinitexe.obj) LIBCMT.lib(crt0init.obj)
Error 17 error LNK2005: __set_app_type already defined in MSVCRT.lib(MSVCR110.dll) LIBCMT.lib(errmode.obj)
Warning 18 warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library LINK
Warning 19 warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library LINK
Error 20 fatal error LNK1169: one or more multiply defined symbols found x64\Release\Hello.exe
Thank you all for your help!
------------------ORIGINAL POST------------------
I have been trying to compile a Fortran code that uses MPI but I keep getting "unresolved external symbol" errors related to MPI. How do I link MPI libraries properly?
I am using the Intel Compiler with Visual Studio and MPI is provided by Microsoft MPI. The error messages are as follows
Error 1 error LNK2019: unresolved external symbol MPI_INIT referenced in function MAIN__ ex5f.obj
Error 2 error LNK2019: unresolved external symbol MPI_COMM_RANK referenced in function MAIN__ ex5f.obj
Error 3 error LNK2019: unresolved external symbol MPI_COMM_SIZE referenced in function MAIN__ ex5f.obj
Error 4 error LNK2019: unresolved external symbol HYPRE_IJMATRIXCREATE referenced in function MAIN__ ex5f.obj
Error 5 error LNK2019: unresolved external symbol HYPRE_IJMATRIXSETOBJECTTYPE referenced in function MAIN__ ex5f.obj
Error 6 error LNK2019: unresolved external symbol HYPRE_IJMATRIXINITIALIZE referenced in function MAIN__ ex5f.obj
Error 7 error LNK2019: unresolved external symbol HYPRE_IJMATRIXSETVALUES referenced in function MAIN__ ex5f.obj
Error 8 error LNK2019: unresolved external symbol HYPRE_IJMATRIXASSEMBLE referenced in function MAIN__ ex5f.obj
Error 9 error LNK2019: unresolved external symbol HYPRE_IJMATRIXGETOBJECT referenced in function MAIN__ ex5f.obj
Error 10 error LNK2019: unresolved external symbol HYPRE_IJVECTORCREATE referenced in function MAIN__ ex5f.obj
Error 11 error LNK2019: unresolved external symbol HYPRE_IJVECTORSETOBJECTTYPE referenced in function MAIN__ ex5f.obj
Error 12 error LNK2019: unresolved external symbol HYPRE_IJVECTORINITIALIZE referenced in function MAIN__ ex5f.obj
Error 13 error LNK2019: unresolved external symbol HYPRE_IJVECTORSETVALUES referenced in function MAIN__ ex5f.obj
Error 14 error LNK2019: unresolved external symbol HYPRE_IJVECTORASSEMBLE referenced in function MAIN__ ex5f.obj
Error 15 error LNK2019: unresolved external symbol HYPRE_IJVECTORGETOBJECT referenced in function MAIN__ ex5f.obj
Error 16 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGCREATE referenced in function MAIN__ ex5f.obj
Error 17 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETPRINTLEVEL referenced in function MAIN__ ex5f.obj
Error 18 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETOLDDEFAULT referenced in function MAIN__ ex5f.obj
Error 19 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETRELAXTYPE referenced in function MAIN__ ex5f.obj
Error 20 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETRELAXORDER referenced in function MAIN__ ex5f.obj
Error 21 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETNUMSWEEPS referenced in function MAIN__ ex5f.obj
Error 22 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETMAXLEVELS referenced in function MAIN__ ex5f.obj
Error 23 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETTOL referenced in function MAIN__ ex5f.obj
Error 24 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSETUP referenced in function MAIN__ ex5f.obj
Error 25 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGSOLVE referenced in function MAIN__ ex5f.obj
Error 26 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGGETNUMITERATIONS referenced in function MAIN__ ex5f.obj
Error 27 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGGETFINALRELTVRES referenced in function MAIN__ ex5f.obj
Error 28 error LNK2019: unresolved external symbol HYPRE_BOOMERAMGDESTROY referenced in function MAIN__ ex5f.obj
Error 29 error LNK2019: unresolved external symbol HYPRE_IJMATRIXDESTROY referenced in function MAIN__ ex5f.obj
Error 30 error LNK2019: unresolved external symbol HYPRE_IJVECTORDESTROY referenced in function MAIN__ ex5f.obj
Error 31 error LNK2019: unresolved external symbol MPI_FINALIZE referenced in function MAIN__ ex5f.obj
Error 32 error LNK2001: unresolved external symbol MPI_DUP_FN ex5f.obj
Error 33 error LNK2001: unresolved external symbol MPI_NULL_DELETE_FN ex5f.obj
Error 34 error LNK2001: unresolved external symbol MPI_NULL_COPY_FN ex5f.obj
Error 35 error LNK2001: unresolved external symbol MPI_COMM_DUP_FN ex5f.obj
Error 36 error LNK2001: unresolved external symbol MPI_COMM_NULL_DELETE_FN ex5f.obj
Error 37 error LNK2001: unresolved external symbol MPI_COMM_NULL_COPY_FN ex5f.obj
Error 38 error LNK2001: unresolved external symbol MPI_WIN_DUP_FN ex5f.obj
Error 39 error LNK2001: unresolved external symbol MPI_WIN_NULL_DELETE_FN ex5f.obj
Error 40 error LNK2001: unresolved external symbol MPI_WIN_NULL_COPY_FN ex5f.obj
Error 41 error LNK2001: unresolved external symbol MPI_TYPE_DUP_FN ex5f.obj
Error 42 error LNK2001: unresolved external symbol MPI_TYPE_NULL_DELETE_FN ex5f.obj
Error 43 error LNK2001: unresolved external symbol MPI_TYPE_NULL_COPY_FN ex5f.obj
Error 44 error LNK2001: unresolved external symbol MPI_CONVERSION_FN_NULL ex5f.obj
Error 45 fatal error LNK1120: 44 unresolved externals x64\Release\Test_MPI.exe
The code also uses the Hypre library, developed at the Lawrence Livermore National Laboratory (hence those unresolved external symbols that begin with "HYPRE_"). When I first ran into this issue, I figured it had to do with filename mangling. However, when asked the Hypre library developers, the response I received was:
"These are MPI issues that don't have anything to do with name mangling in hypre (as far as I can see). The hypre library is looking for the C MPI routines while your main program is looking for the Fortran MPI routines, but it's finding neither. My guess is that you probably don't have the MPI library on your link line. You might try looking at some forums that discuss how to use MPI with Visual Studio."
I have tried several combinations of directory paths for "Additional Include Directories" and "Additional Library Directories" in Visual Studio, but that didn't help. The paths linked are:
C:\Program Files (x86)\Microsoft SDKs\MPI\Include
C:\Program Files (x86)\Microsoft SDKs\MPI\Include\x64
C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\
C:\Program Files (x86)\Microsoft SDKs\MPI\Lib\x64
I should note that the code I have been trying to compile is actually an example file included in the Hypre library distribution, and thus I doubt that the issue comes from any coding error. Nevertheless, in case it helps. the code begins with
program ex5f
implicit none
include 'mpif.h'
All I am trying to do is to compile the code. I have found past posts discussing similar issues but they weren't 100% relevant to the issue I am having. Your help and time will be greatly appreciated.
Thank you.

OpenBLAS compilation with Visual studio 2017

I am compiling OpenBLAS with Visual Studio 2017, using this tutorial: https://github.com/xianyi/OpenBLAS/wiki/How-to-use-OpenBLAS-in-Microsoft-Visual-Studio#cmake-and-visual-studio. It works perfectly. However, when I try to link to a project that is using OpenBLAS, I have errors during the link.
error LNK2019: unresolved external symbol spotrf_
error LNK2019: unresolved external symbol dpotrf_
error LNK2019: unresolved external symbol spotri_
error LNK2019: unresolved external symbol dpotri_
error LNK2019: unresolved external symbol sgeqrf_
error LNK2019: unresolved external symbol dgeqrf_
error LNK2019: unresolved external symbol sorgqr_
error LNK2019: unresolved external symbol dorgqr_
error LNK2019: unresolved external symbol ssyevd_
error LNK2019: unresolved external symbol dsyevd_
This project was working perfectly with the downloaded binary version of OpenBLAS. The only notable difference is, I changed the include path to the one generated by CMake. And instead of linking to libopenblas.dll.a, I link to openblas.lib, which should be a more Visual-Studio-friendly way of linking...
I noticed that all these functions seems to come from Fortran files. Could that be the reason? And since OpenBLAS seems to be compilable with Visual Studio, how to fix the problem?

error LNK2001: unresolved external symbol __CxxFrameHandler3

I am migrating Qt to Qt 5.10.1 from VS 2013 to VS 2015. Getting following multiple link errors.
error LNK2001: unresolved external symbol __CxxFrameHandler3
error LNK2001: unresolved external symbol strcmp
error LNK2001: unresolved external symbol __imp__invalid_parameter_noinfo_noreturn
error LNK2001: unresolved external symbol memcpy
error LNK2001: unresolved external symbol _CxxThrowException
error LNK2001: unresolved external symbol __imp_calloc
error LNK2001: unresolved external symbol fabs
error LNK2001: unresolved external symbol __imp___stdio_common_vsprintf
error LNK2001: unresolved external symbol __std_terminate
error LNK2001: unresolved external symbol memset
error LNK2001: unresolved external symbol strlen
error LNK2001: unresolved external symbol __C_specific_handler
error LNK2001: unresolved external symbol _initialize_narrow_environment
Note:In order to migrate to VS 2015, I have right clicked on project and upgraded to latest, in my case VS 2015
In my project following link property was set to "Yes",
I have updated to "No" fixed my link error.
Project->Properties->Linker->Input->IngoreAllDefaultLibraries to "NO"

Unresolved externals with statically built ffmpeg on Windows

I built ffmpeg 1.2.1 as a static lib - x64, debug. And I tried to open one of my older projects that links against it. After modifying some changed APIs and similar in my source, it compiled fine, but I have major problems with linking.
EDITED: the complete latest build output:
1>libavformat.a(mov.o) : error LNK2019: unresolved external symbol __imp__gmtime64 referenced in function mov_read_mvhd
1>libavutil.a(parseutils.o) : error LNK2001: unresolved external symbol __imp__gmtime64
1>libavformat.a(os_support.o) : error LNK2019: unresolved external symbol __imp__wsopen referenced in function ff_win32_open
1>libavcodec.a(pthread.o) : error LNK2019: unresolved external symbol __imp__beginthreadex referenced in function ff_thread_init
1>libavcodec.a(frame_thread_encoder.o) : error LNK2001: unresolved external symbol __imp__beginthreadex
1>libavutil.a(parseutils.o) : error LNK2019: unresolved external symbol __imp__localtime64 referenced in function av_parse_time
1>libavutil.a(parseutils.o) : error LNK2019: unresolved external symbol __imp__time64 referenced in function av_parse_time
1>libavutil.a(parseutils.o) : error LNK2019: unresolved external symbol __imp__mktime64 referenced in function av_parse_time
1>libmingwex.a(lib64_libmingwex_a-mingw_output_format.o) : error LNK2019: unresolved external symbol __mingw_get_msvcrt_handle referenced in function __mingw_set_output_format
1>libmingwex.a(lib64_libmingwex_a-mingw_get_codepage.o) : error LNK2001: unresolved external symbol __mingw_get_msvcrt_handle
What am I doing wrong? What am I missing here?
Does ffmpeg even work today on Windows platform as a static lib, or it becomes less functional on Windows with each new version?
First 8 errors could be solved by manually inserting
#define _CRTIMP
in some files. This will prevent incorrect use of declspec(__dllimport). We are building a static lib, not a DLL, so it shouldn't be there. I also tried using --extra-cflags='-D_CRTIMP' while running configure before building ffmpeg, but it brakes the build totally. So, manual way is the only way.
The last 2 errors are total bitch:
libmingwex.a(lib64_libmingwex_a-mingw_output_format.o) : error LNK2019: unresolved external symbol __mingw_get_msvcrt_handle referenced in function __mingw_set_output_format
1>libmingwex.a(lib64_libmingwex_a-mingw_get_codepage.o) : error LNK2001: unresolved external symbol __mingw_get_msvcrt_handle
I found these symbols in libmingw32.a (if I remember correctly). But, when I link it, I have conflicts with LIBCMTD.lib. Removing the LIBCMTD.lib creates tons of unresolved externals.So, I would say that today we are not able to build ffmpeg as static x64 lib on Windows. It was in a way expected, because each new version was less Windows friendly.

compiling openttd with VS2005 - linker errors in freetype

Well, here's a nice obscure one. I'm trying to compile the latest open transport tycoon source in Visual Studio 2005. (It's a C++ app that uses zlib, dx8 and a few other fairly common libraries).
I get a few linker errors to do with the freetype dependencies:
Error 1 error LNK2001: unresolved external symbol #FT_Done_Face#4 fontcache.obj
Error 2 error LNK2001: unresolved external symbol #FT_Load_Char#12 fontcache.obj
Error 3 error LNK2001: unresolved external symbol #FT_Init_FreeType#4 fontcache.obj
Error 4 error LNK2001: unresolved external symbol #FT_Select_Charmap#8 fontcache.obj
Error 5 error LNK2001: unresolved external symbol #FT_Set_Charmap#8 fontcache.obj
Error 6 error LNK2001: unresolved external symbol #FT_New_Face#16 fontcache.obj
Error 7 error LNK2001: unresolved external symbol #FT_Render_Glyph#8 fontcache.obj
Error 8 error LNK2001: unresolved external symbol #FT_Set_Pixel_Sizes#12 fontcache.obj
Error 9 fatal error LNK1120: 8 unresolved externals ..\objs\Win32\Release\\openttd.exe
I've downloaded the most recent freetype stable and compiled it (also in VS2005), and put the ft2build.h and freetype include directories into my VS8/VC/include directory, and put the libfreetype2.lib library so compiled into my VS8/VC/lib directory. What could I be missing?
Thanks!
The # sign at the start of the mangled function names show that your fontcache.obj file is expecting these functions to have the __fastcall calling convention, which is unusual as the default calling convention is __cdecl. I suspect there's a mismatch somewhere in the compiler settings used to build the libraries and those used to build the application. See here and here for more information.

Resources