arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.12k stars 4.79k forks source link

[Solved] Error in "sonoff_post.h" file when compiling : expected unqualified-id before 'extern' #2964

Closed ThierryM closed 6 years ago

ThierryM commented 6 years ago

Hi, I'm trying to compile on Arduino IDE 1.8.5 and Ubuntu 16.04, the Tasmota firmware versions 5.14 and 6 but I have this error :

Arduino : 1.8.5 (Linux), Carte : "Generic ESP8285 Module, 80 MHz, ck, 26 MHz, 1M (no SPIFFS), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from /perso_ssd/Thierry/Electronique/Domotique/Sonoff Dual/Sonoff-Tasmota-development/sonoff/sonoff.ino:37:0:
sonoff_post.h:28: error: expected unqualified-id before 'extern'
 extern "C" {
 ^
sonoff_post.h:28: error: expected constructor, destructor, or type conversion before 'extern'
In file included from /home/thierry/Arduino/libraries/ArduinoJson/src/ArduinoJson.hpp:7:0,
                 from /home/thierry/Arduino/libraries/ArduinoJson/src/ArduinoJson.h:9,
                 from /perso_ssd/Thierry/Electronique/Domotique/Sonoff Dual/Sonoff-Tasmota-development/sonoff/sonoff.ino:54:
/home/thierry/Arduino/libraries/ArduinoJson/src/ArduinoJson/DynamicJsonBuffer.hpp:16:28: error: expected declaration before end of line
 #pragma GCC diagnostic push
                            ^
Plusieurs bibliothèque trouvées pour "ArduinoJson.h"
Utilisé : /home/thierry/Arduino/libraries/ArduinoJson
Non utilisé : /home/thierry/Arduino/libraries/arduino_605801
Non utilisé : /home/thierry/Arduino/libraries/arduino_356258
Non utilisé : /home/thierry/Arduino/libraries/ArduinoJson-5.11.2
Plusieurs bibliothèque trouvées pour "PubSubClient.h"
Utilisé : /home/thierry/Arduino/libraries/PubSubClient
Non utilisé : /home/thierry/Arduino/libraries/PubSubClient-2.6.09
Plusieurs bibliothèque trouvées pour "TasmotaSerial.h"
Utilisé : /home/thierry/Arduino/libraries/TasmotaSerial-2.0.0
Non utilisé : /home/thierry/Arduino/libraries/TasmotaSerial-1.2.0
Non utilisé : /home/thierry/Arduino/libraries/TasmotaSerial-1.1.0
Plusieurs bibliothèque trouvées pour "IRremoteESP8266.h"
Utilisé : /home/thierry/Arduino/libraries/IRremoteESP8266
Non utilisé : /home/thierry/Arduino/libraries/arduino_972480
Non utilisé : /home/thierry/Arduino/libraries/IRremoteESP8266-2.2.1.02
Plusieurs bibliothèque trouvées pour "esp-knx-ip.h"
Utilisé : /home/thierry/Arduino/libraries/esp-knx-ip-0.5.1
Non utilisé : /home/thierry/Arduino/libraries/esp-knx-ip-0.5.0
exit status 1
expected unqualified-id before 'extern'

I hadn't this error on 5.12 version. Thanks for your help, regards,

Thierry

ascillato commented 6 years ago

Hi

May be there are missing some libraries. Please copy all the libraries provided in https://github.com/arendst/Sonoff-Tasmota/tree/development/lib

Please read the wiki at: https://github.com/arendst/Sonoff-Tasmota/wiki/Arduino-IDE

ThierryM commented 6 years ago

Hi, Thanks Ascillato but I've copied yet the libraries as it's indicated in the Arduino-IDE wiki page. An other idea ? Thanks

ascillato commented 6 years ago

I have arduino working just fine with Tasmota.

Seems that some file is missing in your setup. Have you tried to install arduino again?

ascillato commented 6 years ago

Also you have duplicated libraries. Try delete everything and start a fresh install from zero

ThierryM commented 6 years ago

This is this error that it's important (the other aren't, I had these with the 5.12 version that worked fine) :

sonoff_post.h:28: error: expected unqualified-id before 'extern'
 extern "C" {
 ^
sonoff_post.h:28: error: expected constructor, destructor, or type conversion before 'extern'

Regards

ascillato commented 6 years ago

Some weird compiling errors shows up when having problems with the libraries. The v5.14 and v6 uses more libraries and also some other libraries that were updated. May be that is why the v5.12 compiles in your system.

Please, try a fresh installation from scratch.

ascillato commented 6 years ago

Hi,

Could you manage to solve it ?

ThierryM commented 6 years ago

Hi Adrian, No I didn't have the time to work on this problem. I'll go back here to tell my experience. Regards

andrethomas commented 6 years ago

Hi

If you still fail you are welcome to use the quickstart portable package from https://thehackbox.org/downloads/arduino_esp8266_tasmota-20180614.7z

It is a portable version of Arduino 1.8.5 with support for ESP8266 and Sonoff-Tasmota 6.0.0a added already.

Just extract and run the arduino.exe that is inside the folder and then open the sonoff sketch under the folder portable\sketchbook\sonoff

If you want to see how it was created/updated look at the update.bat file which copied to libs and source into place - This is similar to the process described in the wiki which @ascillato makes reference to.

If solved please close this issue.

edit I see you're running on Linux - the quickstart is only for Windows for now, but check the update.sh script anyway as it may hint at what you are missing in your installation.

andrethomas commented 6 years ago

Here's a portable for Ubuntu x64

https://thehackbox.org/downloads/arduino_esp8266_tasmota-20180615.tar.gz

ThierryM commented 6 years ago

@andrethomas Thanks for the portable for Ubuntu x64. I tried it but I got the same error :

In file included from /perso_ssd/Thierry/Electronique/Domotique/arduino_esp8266_tasmota/portable/sketchbook/sonoff/sonoff.ino:37:0:
sonoff_post.h:28: error: expected unqualified-id before 'extern'
 extern "C" {
 ^
sonoff_post.h:28: error: expected constructor, destructor, or type conversion before 'extern'
In file included from /perso_ssd/Thierry/Electronique/Domotique/arduino_esp8266_tasmota/portable/sketchbook/libraries/ArduinoJson-5.11.2/src/ArduinoJson.hpp:10:0,
                 from /perso_ssd/Thierry/Electronique/Domotique/arduino_esp8266_tasmota/portable/sketchbook/libraries/ArduinoJson-5.11.2/src/ArduinoJson.h:10,
                 from /perso_ssd/Thierry/Electronique/Domotique/arduino_esp8266_tasmota/portable/sketchbook/sonoff/sonoff.ino:54:
/perso_ssd/Thierry/Electronique/Domotique/arduino_esp8266_tasmota/portable/sketchbook/libraries/ArduinoJson-5.11.2/src/ArduinoJson/DynamicJsonBuffer.hpp:19:28: error: expected declaration before end of line
 #pragma GCC diagnostic push

So I will erase the configurations files and re-install Arduino IDE from zero and give a try again. Regards, Thierry

andrethomas commented 6 years ago

Can you give some of the output further up? I want to see where it references the toolchain/compiler

ThierryM commented 6 years ago

See the attachment. Regards, Thierry

log compil Arduino Tasmota.log

andrethomas commented 6 years ago

You are using the sonoff.ino from /perso_ssd/Thierry/Electronique/Domotique/Sonoff Dual/Sonoff-Tasmota-development/sonoff/sonoff.ino

Can you open the one in the /portable/sketchbook/sonoff/ folder instead?

ThierryM commented 6 years ago

Sorry for my mistake but opening now the right file, I have the same error message. See attachment. Regards log compil Arduino Tasmota2.log

andrethomas commented 6 years ago

Hmm

andrethomas commented 6 years ago

Your sonoff_post.h looks like this at the top?

image

ThierryM commented 6 years ago

Yes my sonoff_post.h is the same. I have installed Arduino IDE on an Orange Pi Win Plus under Armbian and now no problem (the time for compiling is just longer). I think that I will reinstall Arduino IDE on my Ubuntu 16.04 and reconfigure it totally (when I'll do, I will report if the bug disappears). Thank you very much for your help, regards

andrethomas commented 6 years ago

Would be interesting to know what is causing it... thanks for the feedback

ThierryM commented 6 years ago

I'm back. I think that I have found the problem : it seems that there is a conflict with the files "user_config_override.h" and "user_config.h" because under my Orange Pi the problem appears again when I use the override file.

ThierryM commented 6 years ago

No problem with the override file : it's just a warning. But my problem appears when I compile with this override file (personnalized version of "user_config_override_sample.h"). I use the development source of Tasmota downloaded here.

Here the message error :

Arduino: 1.8.5 (Linux), Board: "Generic ESP8266 Module, Serial, 80 MHz, ck, 26 MHz, 40MHz, DOUT, 1M (no SPIFFS), 2, v1.4 Higher Bandwidth, Disabled, None, Only Sketch, 115200"

In file included from /home/thierry/Arduino/sonoff/sonoff.ino:35:0:
sketch/user_config_override.h:24:2: warning: #warning **** user_config_override.h: Using Settings from this File **** [-Wcpp]
 #warning **** user_config_override.h: Using Settings from this File ****
  ^
In file included from /home/thierry/Arduino/sonoff/sonoff.ino:35:0:
sketch/user_config_override.h:91:0: warning: "LATITUDE" redefined [enabled by default]
 #define LATITUDE               xx.xxxx           // [Latitude] Your location to be used with sunrise and sunset
 ^
In file included from /home/thierry/Arduino/sonoff/sonoff.ino:33:0:
sketch/user_config.h:149:0: note: this is the location of the previous definition
 #define LATITUDE               xx.xxxxxx         // [Latitude] Your location to be used with sunrise and sunset
 ^
In file included from /home/thierry/Arduino/sonoff/sonoff.ino:35:0:
sketch/user_config_override.h:92:0: warning: "LONGITUDE" redefined [enabled by default]
 #define LONGITUDE              x.xxxx            // [Longitude] Your location to be used with sunrise and sunset
 ^
In file included from /home/thierry/Arduino/sonoff/sonoff.ino:33:0:
sketch/user_config.h:150:0: note: this is the location of the previous definition
 #define LONGITUDE              x.xxxxxx          // [Longitude] Your location to be used with sunrise and sunset
 ^
In file included from /home/thierry/Arduino/sonoff/sonoff.ino:35:0:
sketch/user_config_override.h:98:0: warning: "APP_TIMEZONE" redefined [enabled by default]
 #define APP_TIMEZONE           99                 // [Timezone] +1 hour (Amsterdam) (-13 .. 14 = hours from UTC, 99 = use TIME_DST/TIME_STD)
 ^
In file included from /home/thierry/Arduino/sonoff/sonoff.ino:33:0:
sketch/user_config.h:153:0: note: this is the location of the previous definition
 #define APP_TIMEZONE           1                 // [Timezone] +1 hour (Amsterdam) (-13 .. 14 = hours from UTC, 99 = use TIME_DST/TIME_STD)
 ^
In file included from /home/thierry/Arduino/sonoff/sonoff.ino:37:0:
sonoff_post.h:28: error: expected unqualified-id before 'extern'
 extern "C" {
 ^
sonoff_post.h:28: error: expected constructor, destructor, or type conversion before 'extern'
In file included from /home/thierry/Arduino/libraries/ArduinoJson-5.11.2/src/ArduinoJson.hpp:10:0,
                 from /home/thierry/Arduino/libraries/ArduinoJson-5.11.2/src/ArduinoJson.h:10,
                 from /home/thierry/Arduino/sonoff/sonoff.ino:54:
/home/thierry/Arduino/libraries/ArduinoJson-5.11.2/src/ArduinoJson/DynamicJsonBuffer.hpp:19:28: error: expected declaration before end of line
 #pragma GCC diagnostic push
                            ^
exit status 1
expected unqualified-id before 'extern'
ThierryM commented 6 years ago

I confirm the problem. To reproduce it : Go to "user_config.h", and uncomment this line to use the "user_config_override.h" file : #define USE_CONFIG_OVERRIDE If I comment this line, the problem deseappears.

andrethomas commented 6 years ago

The default is

//#define USE_CONFIG_OVERRIDE

To use config override you need to make sure the contents of user_config_override.h exist and are valid.

Makes sense - so it's not a bug thanks for figuring it out.

Cheers

ThierryM commented 6 years ago

The contents of user_config_override.h exist and are valid : there worked with the previous versions of Tasmota. When I copy the same parameters (there are only the parameters that I personalize) of user_config_override.h into user_config.h, there's no problem.

ascillato commented 6 years ago

Hi,

If your issue is solved, please close it. Thanks! :+1:

Frogmore42 commented 6 years ago

What is in your user_config_overide.h? It looks like you are not undefining the variable before defining it again in user_config_override.h. That is what the error messages you are seeing mean.

ThierryM commented 6 years ago

Hi, Thanks for your help. No this issue isn't solved. Here my user_config_override.h , Regards user_config_override_anon.txt

andrethomas commented 6 years ago

There exists an error in your user_config_override.h

image

If you take out that unwanted * it will compile without any problem

ThierryM commented 6 years ago

Thanks a lot andrethomas : you found MY bug. You teach me a thing. Regards