1

I have the following linker error in one project of a Visual Studio 2013 solution:

error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (__imp_?_Getgloballocale@locale@std@@SAPEAV_Locimp@12@XZ) referenced in function "class std::ctype<char> const & __cdecl std::use_facet<class std::ctype<char> >(class std::locale const &)" (??$use_facet@V?$ctype@D@std@@@std@@YAAEBV?$ctype@D@0@AEBVlocale@0@@Z)

In all projects I linked the run-time library dynamically (/MD).

I considered the hints in the following posts:

but was not able to solve this issue.

Actually, I am not even aware of where in the project _Getgloballocale is used. Maybe it would also help to know the lib in which _Getgloballocale is located.

The projects use the following libraries:

  • cURL
  • Protobuf
  • libboost_thread-vc120-mt-1_56.lib
  • libboost_system-vc120-mt-1_56.lib
  • libboost_python-vc120-mt-1_56.lib
  • libboost_filesystem-vc120-mt-1_56.lib
Community
  • 1
  • 1
alex
  • 2,252
  • 4
  • 23
  • 34
  • 1
    `_Getgloballocale` is an internal and private symbol in the `std::locale` class. You can tell it's internal because the symbol name starts with an underscore and is followed by a capital letter, [and such symbol names are reserved in all scopes for the compiler and standard library](http://stackoverflow.com/a/228797/440558). You don't call it directly but most likely some other function in `std::local` call it. As for the actual problem, why the symbol can't be found, I don't know. – Some programmer dude Jun 03 '15 at 14:54
  • 1
    Try this http://stackoverflow.com/questions/13279015/what-libraries-do-i-need-to-link-to-build-a-googlemock-example It's suggesting conflicting build options between your project and pre-built libs. Looks like your boost libs are /MT and you say your project is /MD. – Richard Critten Jun 03 '15 at 14:57
  • @RichardCritten Boost libs are /MD as well. I tried changing my projects to /MT and then got conflicts with the boost libs. – alex Jun 03 '15 at 15:02
  • @RichardCritten and also in the linked post the linker error is different - it clashes, because the CRT lib is linked twice, as per the comment of the accepted answer – alex Jun 03 '15 at 15:05
  • @RichardCritten actually i realize now from the name of the boost libs that they probably indeed have been build with /mt. have to check this... – alex Jun 03 '15 at 15:09
  • Just for the record `/MT` in apps that have DLLs is unadvised (unless one is really knowing what (s)he's doing). – CristiFati Jun 03 '15 at 15:09

1 Answers1

1

In all projects I linked the run-time library dynamically (/MD).

As others noted, verifying this might be less obvious than appears. For one, some of your libraries might drag in external dependencies that do rely on a mis-matching runtime.

Suggest you link with /VERBOSE on (in your EXE project, properties / linker / general / show progress), and search the output dump for MSVCR. You might catch a different version (msvcr100.lib) or a different configuration (msvcr120d.lib). Also try to search for LIBCMT - that is the library for static linking of the runtime. These typically appear as part of a /DEFAULTLIB linker directive, and you should be able to understand from the dump in which library context this directive is present.

You can also post here the verbose output (or the relevant snippets), and we can try to help interpret it.

Ofek Shilon
  • 14,734
  • 5
  • 67
  • 101