LNK2019: unresolved external symbol __imp_runt​ime_create​_session

Hi Im trying to integrate MatlabCppSharedLib, I havent called any Matlab CPP API in the the code,
just the #include "MatlabCppSharedLib.hpp" and it throwing error
error LNK2019: unresolved external symbol __imp_runtime_create_session referenced in function "bool __cdecl `anonymous namespace'::init(class std::vector<class std::basic_string<char16_t,struct std::char_traits<char16_t>,class std::allocator<char16_t> >,class std::allocator<class std::basic_string<char16_t,struct std::char_traits<char16_t>,class std::allocator<char16_t> > > > const &)" (?init@?A0x1f98654b@@YA_NAEBV?$vector@V?$basic_string@_SU?$char_traits@_S@std@@V?$allocator@_S@2@@std@@V?$allocator@V?$basic_string@_SU?$char_traits@_S@std@@V?$allocator@_S@2@@std@@@2@@std@@@Z)
Have
  1. Added the lib folder path in Linker ->Input
  2. Copied libMatlabCppSharedLib.lib & libMatlabDataArray.lib & mclmcrrt.lib to the build folder
Kindly helpm thanks in advance

1 Comment

Hi, I had a similar problem LNK2021 unresolved external symbol __imp_runtime_create_session.
I added: libMatlabCppSharedLib.lib, libMatlabDataArray.lib, mclmcrrt.lib, and my library specific *.lib generated by Matlab's application compiler to Linker | Input | Additional Dependencies (in a Microsoft VS 2017 c++ project). Rebuild it and there is no error any more.

Sign in to comment.

Answers (0)

Products

Release

R2021a

Asked:

on 29 Apr 2021

Commented:

on 8 Sep 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!