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

Compile fails, reference to 'byte' is ambiguous #82

Open
gjt211 opened this issue Jun 2, 2021 · 9 comments
Open

Compile fails, reference to 'byte' is ambiguous #82

gjt211 opened this issue Jun 2, 2021 · 9 comments

Comments

@gjt211
Copy link

gjt211 commented Jun 2, 2021

Hi, downloaded zip as per instruction, copied files & libraries as directed.
Followed steps in "Getting Started" section, only edited wifi credentials.
Click compile and get lots of errors. First error is

ESP-sc-gway:146:1: error: reference to 'byte' is ambiguous
  146 | byte currentMode = 0x81;
      | ^~~~

These continue and with variations.
I am using a generic ESP8266 with RFM95, but haven't even got to program it yet.

@nigelorr
Copy link

What are you using to build (version number of Arduino / PlatformIO), have you successfully built other code for the same board on that setup?

If not, try that first, it looks like the build tool isn't set up correctly for the board you are targeting.

@nablabla
Copy link

nablabla commented Jul 5, 2021

Hi, same problem here, i am using arduino, the actual version for wemos is 3.0.1, which version should we use? the helltec esp8266 libraries in the wikies are not to be found :(

@nablabla
Copy link

nablabla commented Jul 9, 2021

okay, i got PlatformIO installed. But it has the same problem. As far as I understood it, it should work out of the box in PlatformIO by pulling its dependencies, but then - this happened:
C:/Users//Documents/PlatformIO/Projects/ESP-1ch-Gateway/src/_utils.ino:395:2: error: reference to 'byte' is ambiguous
395 | byte _day = day(eTime);

@dev-strom
Copy link

It seems to be a bug in the Espressif framework since version 3.0.0
See esp8266/Arduino#8089

As a workaround you can use an older version of the framework.
Change in your platformio.ini the line

platform = espressif8266

to

platform = espressif8266@2.6.3

@d-a-v
Copy link

d-a-v commented Jul 10, 2021

(updated)

esp8266/Arduino v3+ now uses gcc10's c++17 which defines the std::byte.
As a result, using Arduino's byte with using namespace std; is incompatible. A temporary fix could be to locally remove using namespace std; and use std::stuff instead of stuff where relevant.
Removing Arduino's byte in favour of using std::byte; is not an option because byte test = 0 is an error (int incompatible with byte...)
The esp8266/Arduino core team might come with a 3.0.2 release that will apply a dirty hack to remove the stdc++17 byte definition.(they won't, I'll update #62 but I doubt that the maintainer if this repository cares at all)

In the meantime, release 2.7.4 is more recent that 2.6.3 which still uses gcc4.8 (maybe #62 is needed, I wonder why there's no feedback)(see below)

@nablabla
Copy link

Error: Could not find the package with 'espressif8266 @ 2.7.4' requirements for your system 'windows_amd64'
it appears to not exist. But I am not shure, I just switched to PlatformIO, years ago I was using MS visual micro but the community seems to go the platformIO path instead. It feels so crappy to me. I get a lot of random error messages which I can not make sense of :(

@d-a-v
Copy link

d-a-v commented Jul 10, 2021

(updated)

My bad.
PlatformIO has a different version scheme. 2.6.3 is the right version number.
There's an ongoing proposal to fix this issue in the esp8266 arduino core v3.x. (aborted)
(but #62 is still needed I think).

@nablabla
Copy link

hey thank you for your help, i got it working with espressif8266@2.6.3
but wouldn't it be better if we add the "@x.x.x" to every dependency in platformIO projects? so we can benefit with stability and guarantee that it works in the future

@d-a-v
Copy link

d-a-v commented Jul 10, 2021

That's a question to ask to platformIO

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

5 participants