Lot of "was not declared in this scope" errors in compilation. No clue.

I am trying to compile the espurna project for the sonoff TH10/16 on the Arduino IDE 1.6.9.
I am following the instruction given in the project site, but unfortunately I get a lot of error messages during compilation:

- many of this type ('not declared'):
      'xx..x' was not declared in this scope
- some in the variant:
      'yy..y' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
- several of this type ('no matching function'):
      no matching function for call to 'getSetting(const char*&)'
- one as follows:
      there are no arguments to 'mqttSendRaw' that depend on a template parameter, so a declaration of 'mqttSendRaw' must be available [-fpermissive]

I have no idea where the problem is nor how to investigate by myself.
What can I do? (I also searched for a forum on that project, but I found nothing)

Please read the"how to use this forum" topic

AWOL, I had read that topic before posting and I read it again after your suggestion. I am sorry if in your opinion my post has something wrong in it, and I feel ready to apologize in that case. But, frankly speaking, I do not understand what is actually wrog. Could you please be more specific? Thank you.

You very obviously have major bugs in your code. If you expect people yo be able to tell you what you're doing wrong without seeing your code, then you should be posting on a psychic-programmers web site. There is no way anyone here can help without seeing your code.

Regards, Ray L.

AWOL: I am seeing now that my profile shows on the left of my post (something that I did not supposed to happen) and continues to show even now that I have deleted it. I am sorry about that.

RayLivingston: The fact is that this was not my code. I downloaded it from the site I have inserted the link to; I am trying to compile it - without any personal modification but simple uncommenting two configuration flags.

I have done this in the hope of - meeting somebody who shares my interest in that project (apparently that site has no forums); and/or - meeting somebody - more experienced than me - that recognize, e.g., a typical mistake and give me some suggestion how to correct it;

I have not completely understood your mentioning of a "psychic-programmer web site", but it does not look like a polite remark. Was it?

ginsi: The fact is that this was not my code. I downloaded it from the site

So, you’re expecting others to help you by going out and downloading the code and libraries themselves, and then figure out how to set up the IDE for a sonoffTH10/16, then figure out why the code won’t compile? For free? Asking a bit much don’t you think? Why not help out people who are trying to help you by gathering up all the code and posting it right in the forum with your question?

ginsi: …without any personal modification but simple uncommenting two configuration flags

That makes it YOUR code.

Just post the code that your trying to compile. Read the referenced sticky how to post code correctly. Note that as we can’t see your code we don’t now if you made copy/paste errors.

And please provide clickable links to libraries if needed.

If it’s multiple files, post them in subsequent posts or zip them and attach.

The psychic was a reference to the fact that we are not psychics and can’t see what you did :wink:

It does not matter where the code came from it is you that is using it now.

Copy it from your IDE and post it here using code tags

The fact that you did not mention that you are using an ESP8266 was a mistake, don’t you think ?

Post the full text of all the compile errors.

I'd wager money that there's a problem with it barfing on some library that assumes a specific architecture (probably AVR) and isn't compatible with ESP8266 (how does above poster know you're using one of those? I can't find where you said that) - and then since that library won't build, it spews reams of errors at you from every reference to something from the library.

If you want to fix the problems yourself: Start with the first error (they often cascade). Figure out where that variable was supposed to be declared, based on the variable name. Perhaps a library has been modified to use new names. If so, update the code to match the library or downgrade the library to match the code.

DrAzzy: here (the 2nd link that I provided in my first post here), 5th picture, one can see that the "generic ESP8266" board is a suitable target.

all: As far as I can see all "includes" are already contained in the original software; Anyway I have tried to insert all of them in the very first lines of the main .ino file (espurna.ino) but list of errors I got is exactly identical (but for line numbers quoted therein). The error messages are 1120 lines. Shall I really post it?

gfvalvo: I do not expect that somebody will do all that work for the sole purpose of helping me

all, >gfvalvo in particular: I think I have clarified at 3:51 what was my hope

all: it is a big project and for sure it would not be good to upload it here! what makes it "my" code (as gfvalvo says) are two flags in arduino.h; I upload the file with my "modifications" here below (please read the lines where you can find the string "GINSI")

// These settings are normally provided by PlatformIO
// Uncomment the appropiate line(s) to build from the Arduino IDE

// Hardware

//#define D1_RELAYSHIELD
//#define NODEMCUV2
//#define SONOFF
#define SONOFF_TH
//#define SLAMPHER
//#define S20
//#define SONOFF_TOUCH
//#define SONOFF_SV
//#define SONOFF_POW
//#define SONOFF_DUAL
//#define ITEAD_MOTOR
//#define SONOFF_4CH
//#define ECOPLUG
//#define WIFI_RELAY_NC
//#define WIFI_RELAY_NO
//#define MQTT_RELAY
//#define AI_LIGHT
//#define ESPURNA_H

// Features (values below are non-default values)

#define ENABLE_DHT            1
//#define ENABLE_DS18B20        1
//#define ENABLE_EMON           1
//#define ENABLE_HLW8018        1
//#define ENABLE_RF             1
//#define ENABLE_FAUXMO         0
//#define ENABLE_NOFUSS         1
//#define ENABLE_DOMOTICZ       0
//#define ENABLE_ANALOG         1

UKHeliBob: probably I should have mentioned it was an ESP8266, as you guessed, and has been a mistake not to do it

all: who is not interested in that not-mine project, please disregard this post; I have never intended that somebody should try to go into it just to help me! since, as far as I know, there is no specific forum on that project and I am interested in compiling it in the Arduino IDE and not in other ways, I have choosen to post my question here.

Thanks to everybody for the attention

johnwasser Thank you very much for the suggestion. I have already done something similar with no success, but I will try again and report.

how does above poster know you're using one of those? I can't find where you said that

He didn't. I followed one of the links that the OP included.

I promised a report, so - even if probably useless - I keep my word:

I have tried to follow the suggestion from johnwasser but I have had no luck. Detailed report is almost impossible.

I also tried to reduce everything to a very minimum as follows: Two ".ino" files: - sketch_jul14b, containing

#define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__)

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:
  • debug.ino, containing
void debugSend_P(const char * ...) {

Alas!, this compile with no errors..

It is unlikely to be an issue in this case because the error messages would probably be different, but just to make sure:

You have placed the espurna project files in the workspace folder and not in the workspace/libraries folder, right?

Otherwise, as requested by others, post the full compile log that you are getting, as a zip file attachment if the size bothers you. Summarizing it as you have done is next to worthless.

Summarizing it as you have done is next to worthless.

ginsi: I promised a report, so - even if probably useless - I keep my word:


ginsi: I also tried to reduce everything to a very minimum as follows: Two ".ino" files: ... ... Alas!, this compile with no errors..

That's good; you know that at least the problems are not with that. So start adding pieces till you get a compile error and solve it.

I am attaching a zip file containing all the error message page from IDE, both in normal and in verbose modes.

Yes, I have placed the project files in the workspace folder, which in my case is
while the IDE folder is
C:\Users\nanni\Documents\ArduinoIDE (perhaps non standard but it should be harmless)
and I noticed that something has been placed (i think by the library manager / include .zip library), in

ErrMsg.zip (13 KB)

Hmm, almost as if there is something wrong the automatic function prototype generation.?.

It might be interesting if you could post the file C:\Users\nanni\AppData\Local\Temp\build958cd1b944c49f482ddeccd570c542c2.tmp\sketch\espurna.ino.cpp after a failed compilation (but check the timestamp to make sure it is updated, not that the buildXXXX… bit has changed).

Since you are using a crusty IDE version, you should update to the latest. At least Arduino core for ESP8266 seems to indicate a preference for 1.8.2.

So the first error is:

In file included from C:\Users\nanni\AppData\Local\Temp\build958cd1b944c49f482ddeccd570c542c2.tmp\sketch\config/all.h:7:0,

                 from C:\Users\nanni\Documents\Arduino\espurna\espurna.ino:22:

C:\Users\nanni\Documents\Arduino\espurna\espurna.ino: In function 'void heartbeat()':

C:\Users\nanni\AppData\Local\Temp\build958cd1b944c49f482ddeccd570c542c2.tmp\sketch\config/debug.h:9:53: error: 'debugSend_P' was not declared in this scope

     #define DEBUG_MSG_P(...) debugSend_P(__VA_ARGS__)


Where was debugSend_P() supposed to be defined? Did some include file not get included? Did some configuration flag not get set right?

The next few errors seem to be about 'mqtt' functions. Could that library have changed to use a different naming convention?

C:\Users\nanni\Documents\Arduino\espurna\espurna.ino:45:5: note: in expansion of macro 'DEBUG_MSG_P'

     DEBUG_MSG_P(PSTR("[MAIN] Time: %s\n"), (char *) NTP.getTimeDateString().c_str());


espurna:46: error: 'mqttConnected' was not declared in this scope

     if (!mqttConnected()) {


espurna:58: error: 'mqttSend' was not declared in this scope

         mqttSend(MQTT_TOPIC_APP, APP_NAME);


espurna:64: error: no matching function for call to 'getSetting(const char [9])'

         mqttSend(MQTT_TOPIC_HOSTNAME, getSetting("hostname").c_str());