Visual Studio Cannot Find MPI Library - visual-studio

------------------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.

Related

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"

LNK2019: unresolved external symbol __imp__dclass

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.

unresolved externals SAP NetWeaver RFC SDK 7.1 client example Visual Studio 2010

I'm trying to compile the companyClient.c in a visual studio 2010 project, but even if i link properly to the lib sapnwrfc.lib i still get several unresolved externals:
Error 1 error LNK2019: unresolved external symbol _RfcCloseConnection#8 referenced in function _errorHandling C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 2 error LNK2019: unresolved external symbol _RfcSAPUCToUTF8#24 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 3 error LNK2019: unresolved external symbol _RfcDestroyFunction#8 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 4 error LNK2019: unresolved external symbol _RfcGetString#24 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 5 error LNK2019: unresolved external symbol _RfcGetStructure#16 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 6 error LNK2019: unresolved external symbol _RfcInvoke#12 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 7 error LNK2019: unresolved external symbol _RfcSetChars#20 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 8 error LNK2019: unresolved external symbol _RfcCreateFunction#8 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 9 error LNK2019: unresolved external symbol _RfcGetFunctionDesc#12 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 10 error LNK2019: unresolved external symbol _RfcOpenConnection#12 referenced in function _nlsui_main C:\Users\Attila\Desktop\SAP_NWR_RFC\SAP_NWR_RFC\companyClient.obj SAP_NWR_RFC
Error 11 error LNK1120: 10 unresolved externals C:\Users\Attila\Desktop\SAP_NWR_RFC\Debug\SAP_NWR_RFC.exe SAP_NWR_RFC
Can you tell me pls if i'm missing anything here?
I followed the guide in the pdf documentation, and also i've read:
(http://help.sap.com/saphelp_nwpi71/helpdata/en/22/0430ba488911d189490000e829fbbd/frameset.htm)
/
NetWeaver RFC SDK/Programming with the NW RFC API/Working with the NW RFC SDK Files
I'd be grateful for any kind of help.
I had the same issue. Make sure you are compiling to the OS, not the chip. If the OS is 32-bit, use the 32 bit compile/link options found here, if the chip and OS are 64-bit, follow the instructions for the 64-bit entry:
https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1056696

How to build this project? (jpeg lib)

Edit: im now using http://code.google.com/p/jpeg-compressor/ so i dont care about making this work anymore.
I downloaded the http://ijg.org/ source code, i tried to build it as a DLL file.
This is farthest i could build until i went into dead-end.
I noticed there was some .c files which i had to delete, but i dont know if i deleted the correct ones, there was at least these files jmemmac.c and jmemdos.c which i figured i dont need. I had to delete jmemmac.c because i compile on windows, but it gave more errors so i kept deleting those useless files, but now i dont know what to do anymore.
Here are all the errors i got when building:
1>.\ansi2knr.c(273) : warning C4013: 'exit' undefined; assuming extern returning int
1>.\example.c(116) : warning C4013: 'exit' undefined; assuming extern returning int
1>.\example.c(379) : warning C4013: 'put_scanline_someplace' undefined; assuming extern returning int
1>ckconfig.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>djpeg.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>rdjpgcom.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>jpegtran.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>cjpeg.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>ansi2knr.obj : error LNK2005: _main already defined in wrjpgcom.obj
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_open_backing_store
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_get_small
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_mem_term
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_free_large
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_get_large
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_mem_available
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_free_small
1>jmemmgr.obj : error LNK2001: unresolved external symbol _jpeg_mem_init
1>example.obj : error LNK2001: unresolved external symbol _image_height
1>example.obj : error LNK2001: unresolved external symbol _image_buffer
1>example.obj : error LNK2001: unresolved external symbol _put_scanline_someplace
1>example.obj : error LNK2001: unresolved external symbol _image_width
Ok, if you're compiling a DLL, you generally don't want any "main" functions. I assume the source files referencing a a function called "main" or "_main" are examples of how to use the library, so it should be save to get rid of those.
In jmemmac.c, there is a function called "jpeg_open_backing_store", which is one of the unresolved external symbols jmemmgr is complaining about. The function appears to have platform-dependant calls, such as the "FindFolder" function for mac.
The only thing I can think of to do is to study jmemmac.c, jmemdos.c and jmemansi.c and rewrite those functions so they will work on a windows platform.
Oh, and as for "exit" being undefined, include "stdlib.h", as it defines the exit function.

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