FreeFileSync C ++错误:“字节”不是“标准”的成员

时间:2018-09-29 10:38:36

标签: c++

我正在尝试构建开源程序并遇到此错误:

$ make
mkdir -p ../Obj/FFS_GCC_Make_Release/ffs/src/base/
g++ -std=c++17 -pipe -DWXINTL_NO_GETTEXT_MACRO -I../.. -I../../zenXml -include "zen/i18n.h" -include "zen/warn_static.h" -Wall -Wfatal-errors -Wmissing-include-dirs -Wswitch-enum -Wcast-align -Wshadow -Wnon-virtual-dtor -O3 -DNDEBUG `wx-config --cxxflags --debug=no` -pthread `pkg-config --cflags gtk+-2.0` -c base/algorithm.cpp -o ../Obj/FFS_GCC_Make_Release/ffs/src/base/algorithm.o
In file included from base/../fs/abstract.h:13:0,
                 from base/structures.h:14,
                 from base/file_hierarchy.h:20,
                 from base/algorithm.h:11,
                 from base/algorithm.cpp:7:
../../zen/serialize.h:35:45: error: ‘byte’ is not a member of ‘std’
     using value_type     = std::vector<std::byte>::value_type;
                                             ^~~~
compilation terminated due to -Wfatal-errors.
Makefile:108: recipe for target '../Obj/FFS_GCC_Make_Release/ffs/src/base/algorithm.o' failed
make: *** [../Obj/FFS_GCC_Make_Release/ffs/src/base/algorithm.o] Error 1

此源文件包含#include <cstdint>

这是代码的问题部分: using value_type = std::vector<std::byte>::value_type;

如何复制:从官方网站下载FreeFileSync源,解压缩

cd FreeFileSync_10.4_Source\FreeFileSync\Source
make

适用于Linux的Windows子系统下的gcc版本7.3.0(Ubuntu 7.3.0-27ubuntu1〜18.04)

2 个答案:

答案 0 :(得分:2)

#include <cstddef>添加到serialize.h和ring_buffer.h

cd ../../zen/
grep -q -F '<cstddef>' serialize.h || sed -i '1s/^/#include <cstddef>\n/' serialize.h
grep -q -F '<cstddef>' ring_buffer.h || sed -i '1s/^/#include <cstddef>\n/' ring_buffer.h

答案 1 :(得分:1)

std :: byte自C ++ 17开始实现。您可以检查编译器版本。