no pre-decrement operator for type [solved]

New to arduino (three weeks in) and having the problem in the title.

I have an esp8266 nodeMCU with a DS1307 RTC and BME280 sensor. I have one simple sketch and it works. This has the following libraries and start-up for wire:

#include <Wire.h>           //for connection via i2c
#include "RTClib.h"         //RTC lib for real time clock
#include "SparkFunBME280.h" //BME280 library

  Wire.begin(D3, D4); // sda, scl

As stated, it works.

Now start to integrate this with a larger project (timestamping sensor readings, store on spiffs, ftp to NAS, and more). This has the following libraries:

#include "ESP8266WiFi.h"       //wifi library for esp8266
#include <FS.h>                //SPIFFS file system
#include <ESP8266mDNS.h>       //required for mDNS services so don't need IP for internet access
#include <WiFiClient.h>        //what is this doing? think http server
#include <NTPClient.h>         //for access to ntp servers
#include <WiFiUdp.h>           //something required also for ntp
#include "ESP8266FtpServer.h"  //ftp server for esp8266

#include <Wire.h>              //for connection via i2c

  Wire.begin(D3, D4); // sda, scl

Try to compile and I get a "no pre decrement operator for type" on wire.begin. This more complicated sketch compiled and ran happily without wire. The inclusion of wire.h and wire.begin are the ONLY changes made to this sketch.

Bit stumped as I've got two separate sketches that compile and run, but when I try and put bits together I've got this problem. Not much point having a web server unless you have some readings on it :frowning:

Note - also tried wire.begin() and it makes no difference, still throws up a compiler error

Post the COMPLETE error message as copied from the bottom (black) section of the IDE window.

Doesn't Wire.begin() need to be inside of a function (setup())?

Wire.begin - yes it is inside setup, just included it to show the function throwing up the error.

gfvalvo - yes below, busy bug hunting at the moment - starting with my simple sketch and slowly pouring the more complicated sketch into it bit by bit. Currently working my way thro' setup{}. This is the error

/home/andy/Arduino/sketches/20190110H-wifi_esp8266/20190110H-wifi_esp8266.ino: In function 'void setup()':
20190110H-wifi_esp8266:204:20: error: no pre-decrement operator for type
   Wire.begin(D3, D4); // sda, scl setup for esp8266
                    ^
exit status 1
no pre-decrement operator for type

Whatever the problem is, it is not any conflict with the libraries. Having commented out the wire statements the error has just shifted a line down, so suspect somehow I've introduced a syntax error.

Thanks for the rapid responses :slight_smile:

NOW POST THE CODE! --- DOH

Mark

Try losing the D so it's

Wire.begin(3, 4);

I suspect the problem is in the lines BEFORE the "Wire.begin()".

Marking this solved. Ported the code from my wifi/FTP/webserver sketch into the sensor sketch into the sensor sketch (the error was when I did it the other way round) and all is well. It must have been a syntax error, but quite how copying one line of code from one working sketch to another caused the problem - no idea?

AndyMH:
Marking this solved. Ported the code from my wifi/FTP/webserver sketch into the sensor sketch into the sensor sketch (the error was when I did it the other way round) and all is well. It must have been a syntax error, but quite how copying one line of code from one working sketch to another caused the problem - no idea?

You never showed the sketch that wasn't compiling so se can't be sure what your mistake was. My guess is that a '--' got included where it did not belong.

Didn't post the code because at the moment it is 800 lines and growing :slight_smile: