简体   繁体   中英

FreeFileSync C++ error: 'byte' is not a member of 'std'

I'm trying to build open source program and getting this error:

$ 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

This source file contains #include <cstdint>

Here is a problem part of code: using value_type = std::vector<std::byte>::value_type;

How to reproduce: Download FreeFileSync source from official website, unpack

cd FreeFileSync_10.4_Source\FreeFileSync\Source
make

gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04) under Windows Subsystem for Linux

Add #include <cstddef> into serialize.h and 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

std::byte is implemented since C++17. You may check your compiler version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM