Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ambigious definition of byte #8193

Closed
1 task done
nablabla opened this issue Jul 4, 2021 · 3 comments
Closed
1 task done

ambigious definition of byte #8193

nablabla opened this issue Jul 4, 2021 · 3 comments

Comments

@nablabla
Copy link

nablabla commented Jul 4, 2021

disclaimer: If I cannot do anything, it is hard to get into this topic, so I have read not everything I am supposed to, I am sorry

Basic Infos

  • [i have no idea] This issue complies with the issue POLICY doc.
  • [this is a bit much sorry] I have read the documentation at readthedocs and the issue is not addressed there.
  • [i don't now how to do that since these files are buried in my file system] I have tested that the issue is present in current master branch (aka latest git).
  • [I did] I have searched the issue tracker for a similar issue.
  • [n/a] If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: wemos [ESP-12-S
  • Core Version: [3.0.1
  • Development Env: Arduino IDE
  • Operating System: Windows

Settings in IDE

  • Module: Wemos D1 mini r2 (or clone, not shure which is correct for me, the problem is in both)
  • Flash Mode: dout
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • Reset Method: i am blind or this does not exist
  • Flash Frequency: 40Mhz
  • CPU Frequency: 80Mhz
  • Upload Using: I can not find this settings either, but i am not doing OTA
  • Upload Speed: now i am really doubting my sanity, i can not find this setting either

Problem Description

i get this error on compiling: reference to 'byte' is ambiguous.
It seems to me that there are two definitions of "byte" in hardware definition and tools. Only when using std namespace.

MCVE Sketch

using namespace std;
byte currentMode = 0x0;

void loop() {
currentMode++;
}

Debug Messages

sketch_jul04b:2:1: error: reference to 'byte' is ambiguous
2 | byte currentMode = 0x0;
| ^~~~
In file included from c:\users<<>>\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.3-gcc10.3-9bcba0b\xtensa-lx106-elf\include\c++\10.3.0\cmath:42,
from c:\users<<>>\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.3-gcc10.3-9bcba0b\xtensa-lx106-elf\include\c++\10.3.0\math.h:36,
from C:\Users<<>>\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\3.0.1\cores\esp8266/Arduino.h:34,
from sketch\sketch_jul04b.ino.cpp:1:
c:\users<<>>\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\3.0.3-gcc10.3-9bcba0b\xtensa-lx106-elf\include\c++\10.3.0\bits\cpp_type_traits.h:404:30: note: candidates are: 'enum class std::byte'
404 | enum class byte : unsigned char;
| ^~~~
In file included from sketch\sketch_jul04b.ino.cpp:1:
C:\Users<<>>\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\3.0.1\cores\esp8266/Arduino.h:160:17: note: 'typedef uint8_t byte'
160 | typedef uint8_t byte;
| ^~~~
reference to 'byte' is ambiguous

@TD-er
Copy link
Contributor

TD-er commented Jul 4, 2021

Looks like it might be related to this pending PR: #8090

@d-a-v
Copy link
Collaborator

d-a-v commented Jul 4, 2021

using namespace std; is currently incompatible with byte with c++17 and Arduino.

@devyte
Copy link
Collaborator

devyte commented Jul 4, 2021

Previous comment is correct. Don't do that, there are many reasons against using namespace std, including that old frameworks may clash with the STL. The Arduino reference is old.
Closing due to user error.

@devyte devyte closed this as completed Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants