Miscrosoft VS C++ linking error when building for 64bit version - c++

I am using Visual Studio 2005.
I am able to build 32bit without issue. But when I am building
64bit version, I am getting below linking error:
1>QALPROC.exp : error LNK2001: unresolved external symbol "const CustomMessageException::`vftable'" (??_7CustomMessageException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const DBException::`vftable'" (??_7DBException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const Exception::`vftable'" (??_7Exception##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const FileExportLoadException::`vftable'" (??_7FileExportLoadException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const PMemoryException::`vftable'" (??_7PMemoryException##6B#)
1>QALPROC.exp : error LNK2001: unresolved external symbol "const ReportsLoadingException::`vftable'" (??_7ReportsLoadingException##6B#)

Related

Error Calling dmumps_c() and zmumps_c() for MUMPS 5.5.1.5

I m using MUMPS 5.5.1.5 compiled with CMake 3.24.2 and Intel one Api on Windows .
After generating and Building the projects .
I Had called dmumps_c() and zmumps_c() from mumps libraries .
Errors appeared ::
DirectMumps.obj : error LNK2001: unresolved external symbol "void __cdecl _com_issue_error(long)" (?_com_issue_error##YAXJ#Z)
1>DirectMumps.obj : error LNK2001: unresolved external symbol "char * __cdecl _com_util::ConvertBSTRToString(wchar_t *)" (?ConvertBSTRToString#_com_util##YAPEADPEA_W#Z)
1>zmumps.lib(mumps_c.obj) : error LNK2001: unresolved external symbol ZMUMPS_SET_TMP_PTR
1>zmumps.lib(mumps_c.obj) : error LNK2001: unresolved external symbol ZMUMPS_F77
1>dmumps.lib(mumps_c.obj) : error LNK2001: unresolved external symbol DMUMPS_SET_TMP_PTR
1>dmumps.lib(mumps_c.obj) : error LNK2001: unresolved external symbol DMUMPS_F77
Please Any help.

Static linking OpenCV CUDA application errors on external symbol

Hi I am trying to compile a OpenCV (2.6.4) CUDA program on my Win7 Visual Studio, using static link in order to allow the program to run on another computer without CUDA/OpenCV installed. I think i got pretty close but I get stuck in these errors:
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C2R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C3R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C2R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C2R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_8u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_8u_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_8u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16u_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16s_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32s_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32f_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32f_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32f_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u32s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s32s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u8u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s8u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_32f8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_32f16u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_32f16s_C1R
Here's what I did so far. Compiled OpenCV with:
WITH_CUDA = ON, BUILD_SHARED_LIBS = OFF
I ran opencv_test_gpu and confirmed my OpenCV was built with CUDA support. I also ensure static libs are built instead of dynamic libs, judging from the *.lib file size and simple compilation test. On the VS 2012 side:
Include Directory = C:\opencv_built\install\include, Runtime Library = /MT, Library directory = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\lib\Win32;C:\opencv_built\install\share\OpenCV\3rdparty\lib;C:\opencv_built\install\lib; Additional Dependencies: cudart_static.lib;opencv_calib3d246.lib;opencv_contrib246.lib;opencv_core246.lib;opencv_features2d246.lib;opencv_flann246.lib;libtiff.lib;libpng.lib;libjpeg.lib;libjasper.lib;IlmImf.lib;zlib.lib;opencv_highgui246.lib;opencv_imgproc246.lib;opencv_legacy246.lib;opencv_ml246.lib;opencv_nonfree246.lib;opencv_objdetect246.lib;opencv_photo246.lib;opencv_stitching246.lib;opencv_ts246.lib;opencv_video246.lib;opencv_videostab246.lib;Vfw32.Lib;comctl32.lib;%(AdditionalDependencies).
Can anyone please share some insight where did it went wrong?
I don't believe it's possible (currently, with CUDA 5.5) to build a fully statically-linked application using the npp library. That is because a portion of the library is delivered via a dll component. Read section 15.4 here
In fact, this was not possible at all with CUDA until recently (CUDA 5.5) when a fully statically linkable CUDA runtime library was delivered. So ordinary CUDA applications can be created which don't require additional CUDA dll's to run. However, AFAIK, the libraries (e.g. CUBLAS, CUFFT, CUSPARSE, NPP) all have dll components, and don't offer a fully static version of the library to link against.
EDIT: As newer CUDA versions have been released, some CUDA libraries have incorporated static library/link options. As of CUDA 9.1, the basic CUDA runtime library (libcudart) has a static option (libcudart_static, which is now the default option for nvcc compilation), as do CUFFT (libcufft_static), CUBLAS (libcublas_static), CUSPARSE, CUSOLVER, and NVGRAPH. As of CUDA 9.0/9.1, the NPP libraries have been split into a variety of sub-libraries, but these are all available in static versions as well.

I am trying to use a 2005 era library with MSVC 2013 but I am getting unresolved externals errors in Release Mode

The setup:
I have successfully compiled DarkGDK, a library designed for use with DirectX SDK 2007 and VS 2008, in VS 2013 with DirectX SDK 2010. I replaced one of the component libraries with a custom dummy library to resolve DirectX conflicts. I was able to successfully compile all of these component libraries.
The Problem:
When I compile my project that makes use of the DarkGDK libraries in Release mode, everything works as expected. I do get an message box complaining that the binary was built without debug information, but my program runs. However, in Debug mode, I get a number of errors. Below find a sample that I believe represents the lot well:
1>convmdl.lib(ConvMDL.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "void __cdecl QuaternionSlerp(float const * const,float * const,float,float * const)" (?QuaternionSlerp##YAXQBMQAMM1#Z)
1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>system.lib(CSystemC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>system.lib(dxdiaginfo.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>convx.lib(ConvX.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>convmd3.lib(ConvMD3.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CBSPTree.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CCompiler.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(ProcessHSR.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>world.lib(Patch.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(Universe.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(cLightMaps.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CSG.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(NVMeshMenderD3DX.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>image.lib(CImageC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>animation.lib(CAnimation.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(DBOFormat.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>basic3D.lib(CObjectManagerC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>core.lib(RenderList.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>display.lib(CGfxC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>file.lib(CFileC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>sprites.lib(CSpriteManagerC.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW
1>Debug\Weapon Creator 2 - Project Golden Girl.exe : fatal error LNK1120: 1 unresolved externals
I have been searching about this issue for a few days now. I have have checked all the projects' settings that belong to the DarkGDK library and my own project's settings. In Debug configuration they are all using "Multi-threaded Debug (/MTd)".
TL;DR
I am getting the above errors when attempting to compile a project in Debug configuration that uses the DarkGDK Library. All projects have the same Windows Library and C run time settings.
Thank you!
Edit: Errors changed to reflect Dauphic's contribution.
You're mixing debug and release runtimes.
__CrtDbgReportW only exists in the debug runtime. If it's unresolved, it means you're probably compiling using the release runtime, but one of your libraries is using the debug runtime. You have to recompile one or the other, so they both use the same version.
You can find the runtime property at Project Properties -> C/C++ -> Code Generation -> Runtime Library
For the unresolved ATL symbol, I believe you need to link atls.lib.

Calling a c++ .exe from Matlab - Program Stopped Working?

I wrote a code in C++ called FaceTracker.cpp and other code in Matlab that do some analyzes and statics.
What I need to do is adding a button in matlab that calls the FaceTracker when being pressed. I tried to use the following command:
system (['FaceTracker.exe <' nameOfVideo]);
but it doesn't work. It opens the FaceTracker.exe GUI, then it stops ! (Like when internet explorer or any other program does sometimes\hang) with the msg "FaceTracker.exe stoped working.
When I tried to run the .exe from command prompt it showed me the following error:
Assertion Faile: Type == IO::TRACKER ... Debug error! R6010 - abort() has been called.
From what i understd from the answers\ other sites is that I need to statically link libraries.
I read in one site that I need to make the following changes:
The CRT:
• Configuration Properties -> C/C++ -> Code Generation: Where it reads Runtime Library, change to Multi-Threaded (/MT).
The manifest must go:
• Configuration Properties -> Manifest Tool -> Input and Output: Where it reads Embed Manifest, change to No.
But when I do it (Change to /MT) I start getting the following errors:
1> Generating Code... 1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>Tracker.obj : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "public: void
__thiscall FACETRACKER::Tracker::Load(char const *)" (?Load#Tracker#FACETRACKER##QAEXPBD#Z) 1>libcpmtd.lib(stdthrow.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol
__CrtDbgReportW 1>libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol __CrtDbgReportW 1>IO.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>Patch.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>PAW.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>PDM.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>CLM.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FaceTracker.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FCheck.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>FDet.obj : error LNK2001: unresolved external symbol __CrtDbgReportW 1>libcpmtd.lib(cin.obj) : error LNK2001: unresolved external symbol
__free_dbg 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __free_dbg 1>Tracker.obj : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(cout.obj) : error LNK2001: unresolved external symbol
__free_dbg 1>IO.obj : error LNK2001: unresolved external symbol __free_dbg 1>Patch.obj : error LNK2001: unresolved external symbol __free_dbg 1>PAW.obj : error LNK2001: unresolved external symbol __free_dbg 1>PDM.obj : error LNK2001: unresolved external symbol __free_dbg 1>CLM.obj : error LNK2019: unresolved external symbol __free_dbg referenced in function "private: void __thiscall std::_Yarn<char>::_Tidy(void)" (?_Tidy#?$_Yarn#D#std##AAEXXZ) 1>FaceTracker.obj : error LNK2001: unresolved external symbol
__free_dbg 1>FCheck.obj : error LNK2001: unresolved external symbol __free_dbg 1>FDet.obj : error LNK2001: unresolved external symbol __free_dbg 1>libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char
*,int)" (??2#YAPAXIABU_DebugHeapTag_t#std##PADH#Z) 1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol __malloc_dbg 1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol __malloc_dbg 1>libcpmtd.lib(_tolower.obj) : error LNK2019: unresolved external symbol __calloc_dbg referenced in function __Getctype 1>C:\Users\wew\Documents\Jam3a\PROJECT-2012!!\FindSymetryInFaces\FaceTracker\Debug\FaceTracker.exe : fatal error LNK1120: 4 unresolved externals
Any Suggestions?
What do I Have to do in order to be able to use the FaceTracker.exe in every computer, also the ones that doesn't have c++\vs compiler?
besides, why does my program OPENS when I call it from matlab but then Hangs\stops working?
Thank in advance.
This almost certainly has nothing to do with debug versus release or whether mt is enabled. You are not making a matlab extension, just using a binary from the command line. If the program works when you type things in from the command line, it should work when called from Matlab unless you are running low on memory (highly unlikely also).
I would examine the contents of . .
['FaceTracker.exe < ' InputVid]
...and copy and paste the string directly into the command line (system, not Matlab) to see if you can replicate the error. The error is most likely occurring because your exe is not handling the file string well.
Try putting the inputvid, calling m file, and FaceTracker.exe in the working directory to make the most simple scenario. If that works, make things more complex by placing input vid into another directory and bug hunt from there.
Best of luck!
I think this exe file depends on some other libraries. You should copy them into one of the directories in your system parameter PATH. Or you can use the static link option when build your project.
Your applications don't require the entire Visual C++ compiler to be installed, just the runtime library. Microsoft has a free redistributable which can add this runtime library to any computer. You can find vcredist_x86.exe in your Visual C++ install path, or download it from http://www.microsoft.com/en-us/download/details.aspx?id=8328

Error in Release mode but not in Build mode

I recently made a project using opencv and c++ in visual 2008
When i build the project in Debug mode - i don't face any issues - but when i build it in release mode i get the following errors:
1>test.obj : error LNK2001: unresolved external symbol _cvHaarDetectObjects
1>test.obj : error LNK2001: unresolved external symbol _cvCvtColor
1>test.obj : error LNK2001: unresolved external symbol _cvCreateImage
1>test.obj : error LNK2001: unresolved external symbol _cvDestroyWindow
1>test.obj : error LNK2001: unresolved external symbol _cvWaitKey
1>test.obj : error LNK2001: unresolved external symbol _cvGetSize
1>test.obj : error LNK2001: unresolved external symbol _cvReleaseCapture
1>test.obj : error LNK2001: unresolved external symbol _cvCreateMemStorage
1>test.obj : error LNK2001: unresolved external symbol _cvClone
1>test.obj : error LNK2001: unresolved external symbol _cvNamedWindow
1>test.obj : error LNK2001: unresolved external symbol _cvQueryFrame
1>test.obj : error LNK2001: unresolved external symbol _cvLoad
1>test.obj : error LNK2001: unresolved external symbol _cvRectangle
1>test.obj : error LNK2001: unresolved external symbol _cvCreateCameraCapture
1>test.obj : error LNK2001: unresolved external symbol _cvGetSeqElem
1>test.obj : error LNK2001: unresolved external symbol _cvShowImage
Check Linker->Input->Additional Dependencies settings in the Release configuration ; you have undoubtedly forgotten to include the OpenCV libraries. Just copy-paste them from the Debug configuration, but don't forget to remove the d suffix.
E.g. cv210.lib : Release mode and cv210d.lib : Debug mode.
You are not including the same libraries in your release build that you include in your debug build. "unresolved external symbol" means it cannot find the implementation for a function you are referencing.
This happens when you give Additional Dependencies to Debug mode but not in Release.