GDS3D icon indicating copy to clipboard operation
GDS3D copied to clipboard

Compilation failed with clang-16: error: reference to 'byte' is ambiguous

Open yurivict opened this issue 1 year ago • 3 comments

In file included from main.cpp:29:
In file included from ./main.h:24:
In file included from ./../gdsoglviewer/windowmanager.h:29:
../libgdsto3d/gds_globals.h:119:2: error: reference to 'byte' is ambiguous
        byte RecordType;
        ^
../libgdsto3d/gds_globals.h:115:23: note: candidate found by name lookup is 'byte'
typedef unsigned char byte;
                      ^
/usr/include/c++/v1/cstddef:72:12: note: candidate found by name lookup is 'std::byte'
enum class byte : unsigned char {};
           ^
In file included from main.cpp:29:
In file included from ./main.h:24:
In file included from ./../gdsoglviewer/windowmanager.h:29:
../libgdsto3d/gds_globals.h:120:2: error: reference to 'byte' is ambiguous
        byte DataType;
        ^
../libgdsto3d/gds_globals.h:115:23: note: candidate found by name lookup is 'byte'
typedef unsigned char byte;
                      ^
/usr/include/c++/v1/cstddef:72:12: note: candidate found by name lookup is 'std::byte'
enum class byte : unsigned char {};
           ^
In file included from main.cpp:29:
In file included from ./main.h:24:
In file included from ./../gdsoglviewer/windowmanager.h:29:
../libgdsto3d/gds_globals.h:121:2: error: reference to 'byte' is ambiguous
        byte *Data;
        ^
../libgdsto3d/gds_globals.h:115:23: note: candidate found by name lookup is 'byte'
typedef unsigned char byte;
                      ^
/usr/include/c++/v1/cstddef:72:12: note: candidate found by name lookup is 'std::byte'
enum class byte : unsigned char {};
           ^

Revision: 173da0c FreeBSD 13.2

yurivict avatar Jul 05 '23 16:07 yurivict

getting a similar error:

make: Entering directory '/home/calvin/GDS3D/linux'
g++ -c -w -O1 -I ../math/ -I ../gdsoglviewer/ -I ../libgdsto3d/ main.cpp -o main.o
In file included from ../gdsoglviewer/windowmanager.h:29,
                 from main.h:24,
                 from main.cpp:29:
../libgdsto3d/gds_globals.h:119:9: error: reference to ‘byte’ is ambiguous
  119 |         byte RecordType;
      |         ^~~~
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 ../libgdsto3d/gds_globals.h:33,
                 from ../gdsoglviewer/windowmanager.h:29,
                 from main.h:24,
                 from main.cpp:29:
/usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from ../gdsoglviewer/windowmanager.h:29,
                 from main.h:24,
                 from main.cpp:29:
../libgdsto3d/gds_globals.h:115:23: note:                 ‘typedef unsigned char byte’
  115 | typedef unsigned char byte;
      |                       ^~~~
../libgdsto3d/gds_globals.h:120:9: error: reference to ‘byte’ is ambiguous
  120 |         byte DataType;
      |         ^~~~
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 ../libgdsto3d/gds_globals.h:33,
                 from ../gdsoglviewer/windowmanager.h:29,
                 from main.h:24,
                 from main.cpp:29:
/usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from ../gdsoglviewer/windowmanager.h:29,
                 from main.h:24,
                 from main.cpp:29:
../libgdsto3d/gds_globals.h:115:23: note:                 ‘typedef unsigned char byte’
  115 | typedef unsigned char byte;
      |                       ^~~~
../libgdsto3d/gds_globals.h:121:9: error: reference to ‘byte’ is ambiguous
  121 |         byte *Data;
      |         ^~~~
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 ../libgdsto3d/gds_globals.h:33,
                 from ../gdsoglviewer/windowmanager.h:29,
                 from main.h:24,
                 from main.cpp:29:
/usr/include/c++/11/bits/cpp_type_traits.h:404:30: note: candidates are: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from ../gdsoglviewer/windowmanager.h:29,
                 from main.h:24,
                 from main.cpp:29:
../libgdsto3d/gds_globals.h:115:23: note:                 ‘typedef unsigned char byte’
  115 | typedef unsigned char byte;
      |                       ^~~~
make: *** [Makefile:32: main.o] Error 1
make: Leaving directory '/home/calvin/GDS3D/linux'

when running make -C linux on Pop!_OS 22.04 LTS

calvbore avatar Oct 21 '23 23:10 calvbore

@yurivict and @calvbore , did you manage to find a solution? I am having the same problem.

SFCYang avatar Jan 11 '24 04:01 SFCYang

I've just made pull request #24 for a workaround for this problem.

kazutomo avatar Mar 07 '24 16:03 kazutomo

I accept the pull request

trilomix avatar Jun 18 '24 07:06 trilomix