在包含C++头文件的情况下,我在运行Windows子系统Linux(WSL)的Ubuntu 16.04.2下,使用gcc 4.8或clang 3.8构建C++应用程序时出现间歇性"致命错误:...文件未找到"错误自从几天前安装Windows 10 April更新(版本1803,OS Build 17134.1)以来.
来自clang编译器的示例错误消息:
fatal error: 'boost/preprocessor/list/fold_left.hpp' file not found
来自gcc编译器的示例错误消息:
fatal error: boost/mpl/aux_/at_impl.hpp: No such file or directory
我说错误是间歇性的,因为如果我重新运行构建,那么中断构建的特定错误就会消失,并且构建会运行一段时间,直到它成功构建或随机地无法包含其他一些具有相同类型的文件'找不到文件'错误.
这个错误的时间和它的随机性使我怀疑它是WSL中的一个新bug.其他人看到这个或有关于如何解决它的建议?
错误并不总是在Boost包含中,但通常只是因为Boost包含了大部分整体包含文件.正在构建的文件存在于/ mnt/d /下的共享卷上.
我有一个使用在Windows XP SP3中运行的Boost 1.47.0的Visual Studio 2008 C++ 03应用程序.
该调用boost::filesystem::create_directories( L"c:\\foo\\bar" );抛出std::bad_alloc异常.
在输出窗口中,我看到一个调试堆消息:"HEAP [test.exe]:无效的分配大小 - CDCDCDCE(超过7ffdefff)"
callstack显示boost.filesystem在Microsoft标准库文件xlocale第309行中创建新的语言环境和最后一行可见代码.
msvcp90.dll!std::_Allocate<char>() + 0x17 bytes
msvcp90.dll!std::allocator<char>::allocate() + 0xf bytes
msvcp90.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Copy() + 0x70 bytes
msvcp90.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Grow() + 0x26 bytes
msvcp90.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign() + 0x50 bytes
msvcp90.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >() + 0x24 bytes
msvcp90.dll!std::locale::_Locimp::_Locimp() + 0x47 bytes
> test.exe!std::locale::locale<windows_file_codecvt>(const std::locale & _Loc={...}, const windows_file_codecvt * _Facptr=0x00b48f60) Line 309 + 0x69 bytes C++
test.exe!`anonymous namespace'::default_locale() Line 735 C++
test.exe!`anonymous namespace'::path_locale() Line 777 + 0x2a bytes …Run Code Online (Sandbox Code Playgroud)