mio
mio copied to clipboard
Linker errors when using latest mio
After updating to latest mio I'm getting linker errors all over the place. I didn't have these with older mio.
These are the linker errors:
3>common.lib(compressed_reader.obj) : error LNK2005: "class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl mio::detail::win::s_2_ws(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > 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 common.lib(DataSource.obj)
4>common.lib(compressed_reader.obj) : error LNK2005: "class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl mio::detail::win::s_2_ws(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > 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 common.lib(DataSource.obj)
5>common.lib(DataSource.obj) : error LNK2005: "class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl mio::detail::win::s_2_ws(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > 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 common.lib(compressed_reader.obj)
@mandreyel ^^^ please merge
plz
bump
bump @mandreyel
Thanks for the reminder, I haven't been active here. I'm no longer using windows, I'll ask a friend if he could verify this PR. If not, I'll merge it in good faith.
I'd also be open to hand out maintenance rights of this repo to someone who's interested in it as I don't have the capacity to maintain it anymore.
@mandreyel You can merge the PR, it's good. I wish you mentioned that a few months ago, I may have stepped up to the plate :) In the end I wrote my own small mmap object (much less fancy than yours i'll say).
I hope you find someone to maintain this lib! take care
edit : Apparently it's not a pr? Anyhow, you just need to mark the 2 functions inline
. On VS, non-templated "free functions" implemented in headers must be marked inline for the linker. I'm unsure why it compiles on clang / gcc but eh.
That's the PR that closes the issue: https://github.com/mandreyel/mio/pull/88
the PR fixes a few issues in the code. It didn't have inline
to avoid linker errors, it didn't have #include <vector>
because vector was used. Also, on top of that, these changes had to be done in mmap.ipp
and in mio.hpp
files.
My PR updates s_2_ws
so that it doesn't use intermediate vector, but writes directly to preallocated wstring.
Yep, my bad, I had meant to comment on #88 rather than this issue. Either way, it's merged now, thanks everyone for the patience.
I'll put up a notice about looking for a maintainer shortly. I hadn't realized this lib was used much at all...
a very simple github ci script would have caught this. :)
I hadn't realized this lib was used much at all...
good/simple code just walks on its own :wink: