link error LNK2019 introduced by adding std::ofstream on windows VS2017

Qianyu 0 Reputation points
2024-01-09T03:01:42.3066667+00:00

plf_algo_test_lib is the lib to be tested, which is linked to plf_algo_test(test project). The problem is when I added std::ofstream file("debugData.json") code in plf_algo_test_lib, I got the following link error from plf_algo_test.

error Description:

LNK2019 unresolved external symbol "public: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@SAPAV_Locimp@12@XZ) referenced in function "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z)

project: plf_algo_test

file: D:\GitRepos\PLF\plf\build\tests\unit\generic\plf_algo\plf_algo_test_lib.lib(pose_optimize.obj)

Both plf_algo_test_lib and plf_algo_test are compiled with /MDd option.

Here is the output log of plf_algo_test /VERBOSE

log.txt

Any ideas on how to get this error resolved? Thanks in advance.

Developer technologies | Visual Studio | Debugging
Developer technologies | C++
Developer technologies | Visual Studio | Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.