vimpunk / mio

Cross-platform C++11 header-only library for memory mapped file IO
MIT License
1.71k stars 157 forks source link

Including "mio/mmap.hpp" in more than one compilation unit #81

Open utilitydelta opened 2 years ago

utilitydelta commented 2 years ago

Hi,

I get this linker error if I have #include "mio/mmap.hpp" in more than one cpp file:

error LNK2005: "class std::basic_string<wchar_t,struct std::char_traits,class std::allocator > __cdecl mio::detail::win::s_2_ws(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)" (?s_2_ws@win@detail@mio@@YA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@5@@Z) already defined in test.obj

Any ideas on what I can do to fix? Running x64 build on Win11.

Thanks! Tyson

phprus commented 2 years ago

See https://github.com/mandreyel/mio/pull/71

utilitydelta commented 2 years ago

thanks! nice one liner :)