Phylliida / orbslam-windows

Easy build for ORB Slam 2 on Windows
GNU General Public License v3.0
130 stars 73 forks source link

Change Runtime Library setting to Multi-threaded DLL (/MD) #2

Closed QCurry closed 6 years ago

QCurry commented 7 years ago

Hi Phylliida,

Follow your instructions (/MT + Static Library), everything works fined.

Now I want to use it in the other project. The project is an application(.exe), but uses /MD to link to Runtime Library.

So I decide to build a new ORB_SLAM.lib, using /MD + Static Library. Step by step, I can obtain a new ORB_SLAM.lib. Looks good. When I try to test it with example "rgbd_tum" project, it brings following errors:

(Most errors are from pangolin.lib, msvcprt.lib, libcpmt.lib)

pangolin.lib(handler.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in rgbd_tum.obj . . . msvcprt.lib(MSVCP140.dll) : error LNK2005: "public: static unsigned __int64 __cdecl std::ctype<char>::_Getcat(class std::locale::facet const * *,class std::locale const *)" (?_Getcat@?$ctype@D@std@@SA_KPEAPEBVfacet@locale@2@PEBV42@@Z) already defined in pangolin.lib(ffmpeg.obj) . . . libcpmt.lib(ios.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in rgbd_tum.obj

Here's the full error message full_errors.txt

Could you help me? thanks.

Phylliida commented 7 years ago

Ah so what you need to do is rebuild all the dependencies (they are all included in this repo and are in the readme steps below) with the same changes you applied to Orb Slam, otherwise it can't link to the dependencies correctly (hence the errors you are seeing).

Hopefully that helps. I had some trouble getting a dll to build but going through the dependencies and building them should work

QCurry commented 7 years ago

Really appreciate your reply. I found the problem that is made by example rgb_tum. It will link to the old Pangolin.lib which was built by MT runtime library(I built it before).

Anyway, thanks for your suggestion and reply. Have a nice day.