Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing vector in MSVC #76

Open
liurui39660 opened this issue Apr 14, 2021 · 1 comment
Open

Missing vector in MSVC #76

liurui39660 opened this issue Apr 14, 2021 · 1 comment

Comments

@liurui39660
Copy link

Description

When compiled with MSVC (or clang-cl on Windows), the compiler complains vector is not found.

Reproduction

  1. Create a C++ source file
  2. Paste the following code
#include <mio/mmap.hpp>
int main(int argc, char* argv[]) {}
  1. Compile it with MSVC (using Visual Studio, CMake, etc.)

Expected Behavior

The code is compiled successfully.

Actual Behavior

The compiler complains error C2039: 'vector': is not a member of 'std'.

System Info

Windows 10 Pro x64
C++11
mio @ 3f86a95
cmake 3.19.2 (CLion bundled)
cl 19.28.29914 for x64

Possible Solution

For users: Add #include <vector> before #include <mio/mmap.hpp>.

Notes

The complete compilation output, using CMake + Ninja + MSVC in CLion.

====================[ Build | Mio | RelWithDebInfo ]============================
"C:\Program Files\JetBrains\CLion\2021.1\bin\cmake\win\bin\cmake.exe" --build <Path Redacted>\build\release --target Mio
[1/2] Building CXX object CMakeFiles\Mio.dir\example\Mio.cpp.obj
FAILED: CMakeFiles/Mio.dir/example/Mio.cpp.obj 
C:\PROGRA~2\MICROS~2\2019\BUILDT~1\VC\Tools\MSVC\1428~1.299\bin\Hostx64\x64\cl.exe  /nologo /TP -DNOMINMAX -DSOLUTION_DIR=\"<Path Redacted>\" -D_CRT_SECURE_NO_WARNINGS -I..\..\src -I..\..\dep\AUROC -I..\..\dep\mio\include -IC:\ProgramData\vcpkg\installed\x64-windows\include -IC:\ProgramData\Miniconda3\Library\include /DWIN32 /D_WINDOWS /GR /EHsc /Zi /O2 /Ob1 /DNDEBUG -MD /arch:AVX2 /fp:fast /GL /Gw /showIncludes /FoCMakeFiles\Mio.dir\example\Mio.cpp.obj /FdCMakeFiles\Mio.dir\ /FS -c ..\..\example\Mio.cpp
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(60): error C2039: 'vector': is not a member of 'std'
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include\algorithm(40): note: see declaration of 'std'
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(60): error C2065: 'vector': undeclared identifier
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(60): error C2062: type 'wchar_t' unexpected
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(61): error C3536: 'buf': cannot be used before it is initialized
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(61): error C2660: 'MultiByteToWideChar': function does not take 5 arguments
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\stringapiset.h(126): note: see declaration of 'MultiByteToWideChar'
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(61): error C2789: 'wide_char_count': an object of const-qualified type must be initialized
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(61): note: see declaration of 'wide_char_count'
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(62): error C3536: 'wide_char_count': cannot be used before it is initialized
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(62): error C2440: '<function-style-cast>': cannot convert from 'int' to 'std::wstring'
<Path Redacted>\dep\mio\include\mio\detail/mmap.ipp(62): note: No constructor could take the source type, or constructor overload resolution was ambiguous
ninja: build stopped: subcommand failed.
@liurui39660
Copy link
Author

Just found #73 is related to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant