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

Build error: #else if in header should be #elif #4

Closed
AFontaine79 opened this issue Mar 24, 2021 · 2 comments
Closed

Build error: #else if in header should be #elif #4

AFontaine79 opened this issue Mar 24, 2021 · 2 comments

Comments

@AFontaine79
Copy link

Note sure if this works differently on different systems. I am building in PlatformIO for ESP32 DevKitC with following settings:

[env:esp32dev]
platform = espressif32
build_type = debug
debug_tool = esp-prog
board = esp32dev
framework = arduino
lib_deps = lennarthennigs/ESP Telnet@^1.1.0

I changed
#else if defined(ARDUINO_ARCH_ESP8266)
to
#elif defined(ARDUINO_ARCH_ESP8266)

@LennartHennigs
Copy link
Owner

Ah, I'll thx. I'll change this. (It works on the Arduino IDE.)

@AFontaine79
Copy link
Author

AFontaine79 commented Apr 8, 2021

Hi Lennart, I was able to verify what's happening in the Arduino IDE. I realized that PlatformIO is showing a warning but building anyway. This is what the Arduino IDE is doing, except that it normally suppresses warnings. To see the warning in Arduino, go to File -> Preferences and make sure the "compilation" option is checked for "Show verbose output during:". Also, make sure compiler warnings is set to "More" or higher. After you do this and rebuild, you should get the following warning.

D:\Users\AFont\Documents\Arduino\libraries\ESP_Telnet\src/ESPTelnet.h:19:7: warning: extra tokens at end of #else directive [-Wendif-labels]
 #else if defined(ARDUINO_ARCH_ESP8266)
       ^

There is no such thing as #else if, only #elif. Everything following #else is not evaluated, which is why gcc calls them extra tokens. See documentation here. In this case, it doesn't end up affecting the build.

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

2 participants