On 21.10.21 20:21, Étienne Mollier wrote:
Hi Andreas,

Andreas Tille, on 2021-10-21:
In file included from addtargets2.cpp:3:
myutils.h:176:1: error: reference to 'byte' is ambiguous
Since C++ 2017, the std::byte type is defined:

   176 | byte *ReadAllStdioFile(FILE *f, off_t &FileSize);
       | ^~~~
In file included from /usr/include/c++/11/bits/stl_algobase.h:61,
                  from /usr/include/c++/11/bits/char_traits.h:39,
                  from /usr/include/c++/11/string:40,
                  from myutils.h:8,
                  from addtargets2.cpp:3:
/usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: 'enum 
class std::byte'
The redefinition below thus gives indeterminations, as the code
is running in namespace "std":

In file included from addtargets2.cpp:3:
myutils.h:42:23: note:                 'typedef unsigned char byte'
    42 | typedef unsigned char byte;
       |                       ^~~~
myutils.h:177:1: error: reference to 'byte' is ambiguous
The option which seems the most viable would be to replace all
occurrences of the "byte" type by something that does not clash
with the new standard library, maybe "byte8" to be somewhat
consistent with upstream naming conventions.


In hope this helps,

Have a nice evening,  :)

My C++ skills are a bit rosty but would removing the typedef for byte
solve the problem?

Best,
Steffen

Reply via email to