Error During Compiling Arduino Code (NodeMCU) - c++

I have been working with NodeMCU for 1 week but suddenly yesterday, while compiling NodeMCU again, as usual, it is showing error during compiling and not uploading the code. Please help me get out of it.
This is the error coming
Arduino: 1.8.12 (Windows 8.1), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"
In file included from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkApiArduino.h:14:0,
from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkSimpleEsp8266.h:24,
from C:\Users\Govind\Desktop\Stepper_Motor_Joystick_2.21\Stepper_Motor_Joystick_2.21.ino:3:
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkApi.h: In instantiation of 'void BlynkApi<Proto>::syncVirtual(Args ...) [with Args = {}; Proto = BlynkProtocol<BlynkArduinoClientGen<Client> >]':
C:\Users\Govind\Desktop\Stepper_Motor_Joystick_2.21\Stepper_Motor_Joystick_2.21.ino:69:25: required from here
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkApi.h:143:9: error: no matching function for call to 'BlynkParam::add_multi()'
cmd.add_multi(pins...);
^
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkApi.h:143:9: note: candidates are:
In file included from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkApi.h:16:0,
from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkApiArduino.h:14,
from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkSimpleEsp8266.h:24,
from C:\Users\Govind\Desktop\Stepper_Motor_Joystick_2.21\Stepper_Motor_Joystick_2.21.ino:3:
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkParam.h:111:10: note: template<class T, class ... Args> void BlynkParam::add_multi(T)
void add_multi(T last) {
^
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkParam.h:111:10: note: template argument deduction/substitution failed:
In file included from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkApiArduino.h:14:0,
from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkSimpleEsp8266.h:24,
from C:\Users\Govind\Desktop\Stepper_Motor_Joystick_2.21\Stepper_Motor_Joystick_2.21.ino:3:
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkApi.h:143:9: note: candidate expects 1 argument, 0 provided
cmd.add_multi(pins...);
^
In file included from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkApi.h:16:0,
from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkApiArduino.h:14,
from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkSimpleEsp8266.h:24,
from C:\Users\Govind\Desktop\Stepper_Motor_Joystick_2.21\Stepper_Motor_Joystick_2.21.ino:3:
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkParam.h:116:10: note: template<class T, class ... Args> void BlynkParam::add_multi(T, Args ...)
void add_multi(T head, Args... tail) {
^
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkParam.h:116:10: note: template argument deduction/substitution failed:
In file included from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkApiArduino.h:14:0,
from C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/BlynkSimpleEsp8266.h:24,
from C:\Users\Govind\Desktop\Stepper_Motor_Joystick_2.21\Stepper_Motor_Joystick_2.21.ino:3:
C:\Users\Govind\Documents\Arduino\libraries\arduino_238892\src/Blynk/BlynkApi.h:143:9: note: candidate expects 2 arguments, 0 provided
cmd.add_multi(pins...);
^
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I am currently trying to run stepper motors using the AccelStepper library and Blynk Library and also included Esp8266 Library for connectivity. I am not able to understand the problem

Looks like you called Blynk.syncVirtual() without any arguments. You need to include at least one virtual pin, like this:
Blynk.syncVirtual(V4);

Related

Problem in building Aquasim module in NS3

I am getting the following error while building aquasim
In file included from ./ns3/object-base.h:23:0,
from ./ns3/object.h:29,
from ./ns3/energy-source.h:30,
from ../src/aqua-sim-ng/model/aqua-sim-energy-model.cc:21:
./ns3/type-id.h: In instantiation of ‘static ns3::ObjectBase* ns3::TypeId::AddConstructor()::Maker::Create() [with T = ns3::AquaSimEnergyModel]’:
./ns3/type-id.h:659:3: required from ‘ns3::TypeId ns3::TypeId::AddConstructor() [with T = ns3::AquaSimEnergyModel]’
../src/aqua-sim-ng/model/aqua-sim-energy-model.cc:42:42: required from here
./ns3/type-id.h:656:27: error: invalid new-expression of abstract class type ‘ns3::AquaSimEnergyModel’
ObjectBase * base = new T ();
^~~~~~~~
In file included from ../src/aqua-sim-ng/model/aqua-sim-energy-model.cc:26:0:
../src/aqua-sim-ng/model/aqua-sim-energy-model.h:45:7: note: because the following virtual functions are pure within ‘ns3::AquaSimEnergyModel’:
class AquaSimEnergyModel : public DeviceEnergyModel
^~~~~~~~~~~~~~~~~~
In file included from ./ns3/device-energy-model-container.h:26:0,
from ./ns3/energy-source.h:34,
from ../src/aqua-sim-ng/model/aqua-sim-energy-model.cc:21:
./ns3/device-energy-model.h:106:16: note: virtual void ns3::DeviceEnergyModel::HandleEnergyChanged()
virtual void HandleEnergyChanged (void) = 0;
^~~~~~~~~~~~~~~~~~~
Waf: Leaving directory `/home/udit/ns-allinone-3.30.1/ns-3.30.1/build'
Build failed
-> task in 'ns3-aqua-sim-ng' failed with exit status 1 (run with -v to display more information)
try to build ns3 according to this, https://www.nsnam.org/wiki/HOWTO_build_old_versions_of_ns-3_on_newer_compilers
or please provide more details of your NS3 version and GCC compiler.

Platformio compile error: ArduinoJson6100_100::DynamicJsonDocument has no member named 'nestingLimit'

I'm new to c++, and trying to compile simple arduino project in the Platformio.
platformio.ini file:
[platformio]
src_dir = .
lib_extra_dirs = .piolibdeps/, ../../
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps =
# PubSubClient
painlessMesh
main.ino file:
#include <Arduino.h>
#include <painlessMesh.h>
void setup()
{
}
void loop()
{
}
Should be something simple, but I'm getting next error:
'ArduinoJson6100_100::DynamicJsonDocument' has no member named
'nestingLimit'
Full compiler stack:
Executing task in folder test4: platformio run <
Processing nodemcuv2 (platform: espressif8266; board: nodemcuv2;
framework: arduino)
------------------------------------------------------------------------------------------------------------ Verbose mode can be enabled via -v, --verbose option CONFIGURATION:
https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 > NodeMCU 1.0 (ESP-12E Module) HARDWARE:
ESP8266 80MHz 80KB RAM (4MB Flash) Converting main.ino Library
Dependency Finder -> LDF MODES:
FINDER(chain) COMPATIBILITY(soft) Collected 35 compatible libraries
Scanning dependencies... Dependency Graph |-- 1.3.0 |
|-- 6.10.0 | |-- 3.0.2 | |--
1.2.0 | | |-- 1.0 | |--
1.0 Compiling .pioenvs/nodemcuv2/src/main.ino.cpp.o
Generating LD script
.pioenvs/nodemcuv2/ld/local.eagle.app.v6.common.ld Archiving
.pioenvs/nodemcuv2/libef5/libArduinoJson_ID64.a Archiving
.pioenvs/nodemcuv2/libca3/libTaskScheduler_ID721.a Indexing
.pioenvs/nodemcuv2/libef5/libArduinoJson_ID64.a Indexing
.pioenvs/nodemcuv2/libca3/libTaskScheduler_ID721.a Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/BearSSLHelpers.cpp.o Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/CertStoreBearSSL.cpp.o Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/ESP8266WiFi.cpp.o Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/ESP8266WiFiAP.cpp.o Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/ESP8266WiFiGeneric.cpp.o
Compiling .pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/ESP8266WiFiMulti.cpp.o
Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/ESP8266WiFiSTA-WPS.cpp.o
Compiling .pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/ESP8266WiFiSTA.cpp.o
Compiling .pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/ESP8266WiFiScan.cpp.o
Compiling .pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/WiFiClient.cpp.o
Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/WiFiClientSecureAxTLS.cpp.o
Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/WiFiClientSecureBearSSL.cpp.o
Compiling .pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/WiFiServer.cpp.o
Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/WiFiServerSecureAxTLS.cpp.o
Compiling
.pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/WiFiServerSecureBearSSL.cpp.o
Compiling .pioenvs/nodemcuv2/lib6c2/ESP8266WiFi/WiFiUdp.cpp.o
Compiling
.pioenvs/nodemcuv2/lib129/ESPAsyncTCP_ID305/AsyncPrinter.cpp.o
Compiling
.pioenvs/nodemcuv2/lib129/ESPAsyncTCP_ID305/ESPAsyncTCP.cpp.o
Compiling
.pioenvs/nodemcuv2/lib129/ESPAsyncTCP_ID305/ESPAsyncTCPbuffer.cpp.o
Archiving .pioenvs/nodemcuv2/lib6c2/libESP8266WiFi.a Indexing
.pioenvs/nodemcuv2/lib6c2/libESP8266WiFi.a Compiling
.pioenvs/nodemcuv2/lib129/ESPAsyncTCP_ID305/SyncClient.cpp.o Compiling
.pioenvs/nodemcuv2/lib129/ESPAsyncTCP_ID305/tcp_axtls.c.o Compiling
.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/TaskScheduler.cpp.o
Compiling
.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMesh.cpp.o
Compiling
.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMeshAP.cpp.o
Archiving .pioenvs/nodemcuv2/lib129/libESPAsyncTCP_ID305.a Indexing
.pioenvs/nodemcuv2/lib129/libESPAsyncTCP_ID305.a Compiling
.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMeshComm.cpp.o
Compiling
.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMeshConnection.cpp.o
Compiling
.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMeshDebug.cpp.o
Compiling
.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMeshJson.cpp.o
.piolibdeps/painlessMesh_ID1269/src/painlessMeshComm.cpp: In member
function 'String painlessMesh::buildMeshPackage(uint32_t, uint32_t,
meshPackageType, String&)':
.piolibdeps/painlessMesh_ID1269/src/painlessMeshComm.cpp:68:25: error:
no matching function for call to
'ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument()'
DynamicJsonDocument jsonBuffer; ^
.piolibdeps/painlessMesh_ID1269/src/painlessMeshComm.cpp:68:25: note:
candidates are: In file included from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/DynamicJsonDocument.hpp:7:0,
from .piolibdeps/ArduinoJson_ID64/src/ArduinoJson.hpp:21, from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson.h:9, from
.piolibdeps/painlessMesh_ID1269/src/painlessMesh.h:12, from
.piolibdeps/painlessMesh_ID1269/src/painlessMeshComm.cpp:8:
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:50:3:
note:
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(ArduinoJson6100_100::VariantRef)
[with TAllocator = ArduinoJson6100_100::DefaultAllocator]
BasicJsonDocument(VariantRef src) ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:50:3:
note: candidate expects 1 argument, 0 provided
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:43:3:
note: template
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(const
T&, typename
ArduinoJson6100_100::enable_if::value>::type*)
BasicJsonDocument(const T& src, ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:43:3:
note: template argument deduction/substitution failed:
.piolibdeps/painlessMesh_ID1269/src/painlessMeshComm.cpp:68:25: note:
candidate expects 2 arguments, 0 provided DynamicJsonDocument
jsonBuffer; ^ In file included from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/DynamicJsonDocument.hpp:7:0,
from .piolibdeps/ArduinoJson_ID64/src/ArduinoJson.hpp:21, from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson.h:9, from
.piolibdeps/painlessMesh_ID1269/src/painlessMesh.h:12, from
.piolibdeps/painlessMesh_ID1269/src/painlessMeshComm.cpp:8:
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:36:3:
note:
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(const
ArduinoJson6100_100::BasicJsonDocument&) [with TAllocator
= ArduinoJson6100_100::DefaultAllocator] BasicJsonDocument(const BasicJsonDocument& src) ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:36:3:
note: candidate expects 1 argument, 0 provided
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:33:12:
note:
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(size_t,
TAllocator) [with TAllocator = ArduinoJson6100_100::DefaultAllocator;
size_t = unsigned int] explicit BasicJsonDocument(size_t capa,
TAllocator allocator = TAllocator()) ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:33:12:
note: candidate expects 2 arguments, 0 provided
.piolibdeps/painlessMesh_ID1269/src/painlessMeshConnection.cpp: In
member function 'void MeshConnection::handleMessage(String&,
uint32_t)':
.piolibdeps/painlessMesh_ID1269/src/painlessMeshConnection.cpp:543:25:
error: no matching function for call to
'ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument()'
DynamicJsonDocument jsonBuffer; ^
.piolibdeps/painlessMesh_ID1269/src/painlessMeshConnection.cpp:543:25:
note: candidates are: In file included from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/DynamicJsonDocument.hpp:7:0,
from .piolibdeps/ArduinoJson_ID64/src/ArduinoJson.hpp:21, from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson.h:9, from
.piolibdeps/painlessMesh_ID1269/src/painlessMesh.h:12, from
.piolibdeps/painlessMesh_ID1269/src/painlessMeshConnection.cpp:9:
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:50:3:
note:
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(ArduinoJson6100_100::VariantRef)
[with TAllocator = ArduinoJson6100_100::DefaultAllocator]
BasicJsonDocument(VariantRef src) ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:50:3:
note: candidate expects 1 argument, 0 provided
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:43:3:
note: template
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(const
T&, typename
ArduinoJson6100_100::enable_if::value>::type*)
BasicJsonDocument(const T& src, ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:43:3:
note: template argument deduction/substitution failed:
.piolibdeps/painlessMesh_ID1269/src/painlessMeshConnection.cpp:543:25:
note: candidate expects 2 arguments, 0 provided DynamicJsonDocument
jsonBuffer; ^ In file included from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/DynamicJsonDocument.hpp:7:0,
from .piolibdeps/ArduinoJson_ID64/src/ArduinoJson.hpp:21, from
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson.h:9, from
.piolibdeps/painlessMesh_ID1269/src/painlessMesh.h:12, from
.piolibdeps/painlessMesh_ID1269/src/painlessMeshConnection.cpp:9:
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:36:3:
note:
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(const
ArduinoJson6100_100::BasicJsonDocument&) [with TAllocator
= ArduinoJson6100_100::DefaultAllocator] BasicJsonDocument(const BasicJsonDocument& src) ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:36:3:
note: candidate expects 1 argument, 0 provided
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:33:12:
note:
ArduinoJson6100_100::BasicJsonDocument::BasicJsonDocument(size_t,
TAllocator) [with TAllocator = ArduinoJson6100_100::DefaultAllocator;
size_t = unsigned int] explicit BasicJsonDocument(size_t capa,
TAllocator allocator = TAllocator()) ^
.piolibdeps/ArduinoJson_ID64/src/ArduinoJson/Document/BasicJsonDocument.hpp:33:12:
note: candidate expects 2 arguments, 0 provided
.piolibdeps/painlessMesh_ID1269/src/painlessMeshConnection.cpp:544:16:
error: 'ArduinoJson6100_100::DynamicJsonDocument' has no member named
'nestingLimit' jsonBuffer.nestingLimit = 255; ^
* [.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMeshComm.cpp.o]
Error 1
* [.pioenvs/nodemcuv2/lib3f1/painlessMesh_ID1269/painlessMeshConnection.cpp.o]
Error 1
======================================== [ERROR] Took 10.54 seconds ======================================== The terminal process terminated with exit code: 1
What am I doing wrong?
Thanks!
Solved in the library source: https://gitlab.com/painlessMesh/painlessMesh/issues/253
Author comment:
Thanks for reporting. This should be fixed in the latest version
(1.3.1). Let me know if you still have problems

How to format "if" statement in C++ macro (& how to use Arduino's new EEPROM library get & put functions)

Update 3 Jan. 2016: I have answered my own question now too.
I need some help formatting my "if" statement in this C++ macro please:
#define updateEEPROMVal(address,val) if (EEPROM.get(address)!=val) \
EEPROM.put(address,val)
I'm getting pages of errors, so I'm assuming it's a simple formatting problem.
Update Apr. 2020: Jump straight to my answer. My macro was fine (surrounding it with do {} while (false) would have been better of course, but it was fine as-is). I was simply forgetting the 2nd parameter in EEPROM.get() is all. The 2nd parameter is passed by NON-const C++ reference, and at the time I didn't really know what a reference was or how it worked, so I didn't use the .get() method correctly. That's it!
Back to my original question from 2016:
Here's the full context:
//----------------------------------------------------------------------------------------------------------------------------------
//storeXYValsIntoEEPROM
//-store the current global variable x and y low, center, and high values into EEPROM
//----------------------------------------------------------------------------------------------------------------------------------
#define updateEEPROMVal(address,val) if (EEPROM.get(address)!=val) \
EEPROM.put(address,val)
void storeXYValsIntoEEPROM()
{
//update EEPROM values *only* if necessary, this way you minimize writes (and wear-and-tear) on the EEPROM, since it is limited to
//100k writes per cell I believe (see datasheet)
updateEEPROMVal(0,x_low);
updateEEPROMVal(2,x_ctr);
updateEEPROMVal(4,x_high);
updateEEPROMVal(6,y_low);
updateEEPROMVal(8,y_ctr);
updateEEPROMVal(10,y_high);
}
UPDATE: HERE's my error output:
Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"
Using library IRremote in folder: C:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\IRremote (legacy)
Using library eRCaGuy_ButtonReader in folder: C:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\eRCaGuy_ButtonReader (legacy)
Using library EEPROM in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10605 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\IRremote -IC:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\eRCaGuy_ButtonReader -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM C:\Users\Gabriel\AppData\Local\Temp\build6111239347405487460.tmp\IR_Tx_code5_w_calibration_mode.cpp -o C:\Users\Gabriel\AppData\Local\Temp\build6111239347405487460.tmp\IR_Tx_code5_w_calibration_mode.cpp.o
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:43:30: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
operator const uint8_t() const { return **this; }
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:92:26: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
operator const int() const { return index; }
^
IR_Tx_code5_w_calibration_mode.ino: In function 'void storeXYValsIntoEEPROM()':
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:436:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:436:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:436:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:437:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:437:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:437:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:438:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:438:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:438:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:439:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:439:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:439:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:440:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:440:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:440:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: error: no matching function for call to 'EEPROMClass::get(int)'
IR_Tx_code5_w_calibration_mode.ino:441:3: note: in expansion of macro 'updateEEPROMVal'
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate is:
IR_Tx_code5_w_calibration_mode.ino:441:3: note: in expansion of macro 'updateEEPROMVal'
In file included from IR_Tx_code5_w_calibration_mode.ino:27:0:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template<class T> T& EEPROMClass::get(int, T&)
template< typename T > T &get( int idx, T &t ){
^
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\EEPROM/EEPROM.h:130:31: note: template argument deduction/substitution failed:
IR_Tx_code5_w_calibration_mode.ino:430:61: note: candidate expects 2 arguments, 1 provided
IR_Tx_code5_w_calibration_mode.ino:441:3: note: in expansion of macro 'updateEEPROMVal'
Multiple libraries were found for "IRremote.h"
Used: C:\Gabe\Gabe - RC-extra\Arduino\Sketches\libraries\IRremote
Not used: C:\Program Files (x86)\Arduino\libraries\RobotIRremote
no matching function for call to 'EEPROMClass::get(int)'
Code with do{...}while(0) your macro (and don't forget the semicolon):
#define updateEEPROMVal(address,val) do{if (EEPROM.get(address)!=val) \
EEPROM.put(address,val);}while(0)
See also this
Better yet, make that a static inline function (to be put in some header file).
Also, use g++ -C -E source.cc > source.ii to get the preprocessed form, you can look inside it.
There is no need for this. When I wrote the library I made sure it minimizes the wear & tear.
The EEPROM function put() uses the update method on the byte level.
You are simply duplicating functionality.
If you have more questions regarding the EEPROM lib, ask on the forum.
I created a thread just for my library: https://forum.arduino.cc/index.php?topic=312645
My Answer:
Sorry for the trouble, it turns out I was misusing the EEPROM.get function, and the problem wasn't my macro at all. The EEPROM library get() method is defined: https://github.com/arduino/ArduinoCore-avr/blob/master/libraries/EEPROM/src/EEPROM.h#L130, and the documentation here: https://www.arduino.cc/en/Reference/EEPROMGet.
I was simply missing the 2nd argument, accidentally using this:
EEPROM.get(address);
...instead of this:
any_type val_in_EEPROM;
EEPROM.get(address, val_in_EEPROM);
Here are 2 solutions I came up with that work.
1) Using a separate function:
-I prefer this method. It turns out the word "inline" in this case is optional, and makes no difference.
-This method makes my program 7610 bytes, with 472 bytes used for global variables. It takes 162 bytes less memory than option 2 below.
inline void updateEEPROMVal(uint16_t address, uint16_t val)
{
uint16_t val_in_EEPROM;
EEPROM.get(address,val_in_EEPROM);
if (val_in_EEPROM!=val)
EEPROM.put(address,val);
}
void storeGlobalXYValsIntoEEPROM()
{
updateEEPROMVal(0,x_low);
updateEEPROMVal(2,x_ctr);
updateEEPROMVal(4,x_high);
updateEEPROMVal(6,y_low);
updateEEPROMVal(8,y_ctr);
updateEEPROMVal(10,y_high);
}
2) Using a macro, as follows:
-I prefer the above method.
-This method takes 7772 bytes for program space, and 472 bytes for global variables. It takes 162 bytes more than the above method.
uint16_t val_in_EEPROM;
#define updateEEPROMVal(address,val) EEPROM.get(address,val_in_EEPROM); \
if (val_in_EEPROM!=val) \
EEPROM.put(address,val)
void storeGlobalXYValsIntoEEPROM()
{
uint16_t val_in_EEPROM;
updateEEPROMVal(0,x_low);
updateEEPROMVal(2,x_ctr);
updateEEPROMVal(4,x_high);
updateEEPROMVal(6,y_low);
updateEEPROMVal(8,y_ctr);
updateEEPROMVal(10,y_high);
}
Thanks for everyone's help!
3) (Updated answer) EEPROM.put(address,val) already does the functionality I'm trying to achieve above to avoid unnecessary wear on the EEPROM, so just use the .put() function by itself, as-is!
See #Chris A's answer here.
Yet again I have failed to fully read the documentation. The EEPROM library Put function documentation here (https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/libraries/EEPROM) says, "This function uses the update method to write its data, and therefore only rewrites changed cells." Therefore, my update code is redundant. I just need to use the "put" function as-is. Refer to the EEPROM library's author's (Chris A) answer here too.
So, I've learned a lot, and here's my final answer:
Get rid of my support function and macro, and just use the put function as-is. It already minimizes EEPROM wear and only writes if the contents are different. Nevertheless, I'll leave my above answers for completeness' sake for those who are looking for what the macro or function solution otherwise would have been.

Boost 1.5.8 issue

I've got lots of bugs in my old compilation machine so I decided to create a new one.
Boh project doesn't have any issue about compiling in BOOST 1.55, but in 1.5.7 or highter, only one project can compile. (Before, both are using boost 1.5.7 without problem)
Here's the bug when i'm using 1.5.8 (at char_skill.cpp)
http://i.stack.imgur.com/sh8vO.png
Text mode :
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:193:24: note: template argument deduction/substitution failed:
In file included from /usr/src/blabla/Extern/include/boost/functional/hash/hash.hpp:558:0,
from /usr/src/blabla/Extern/include/boost/functional/hash.hpp:6,
from /usr/src/blabla/Extern/include/boost/unordered/unordered_map.hpp:21,
from /usr/src/blabla/Extern/include/boost/unordered_map.hpp:17,
from char.h:4,
from char_skill.cpp:7:
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:262:34: note: 'const VID' is not derived from 'const std::shared_ptr<_Tp1>'
return hash_value(val);
^
In file included from /usr/src/blabla/Extern/include/boost/functional/hash/hash.hpp:558:0,
from /usr/src/blabla/Extern/include/boost/functional/hash.hpp:6,
from /usr/src/blabla/Extern/include/boost/unordered/unordered_map.hpp:21,
from /usr/src/blabla/Extern/include/boost/unordered_map.hpp:17,
from char.h:4,
from char_skill.cpp:7:
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:198:24: note: template<class T, class Deleter> std::size_t boost::hash_value(const std::unique_ptr<_Tp, _Dp>&)
inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) {
^
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:198:24: note: template argument deduction/substitution failed:
In file included from /usr/src/blabla/Extern/include/boost/functional/hash/hash.hpp:558:0,
from /usr/src/blabla/Extern/include/boost/functional/hash.hpp:6,
from /usr/src/blabla/Extern/include/boost/unordered/unordered_map.hpp:21,
from /usr/src/blabla/Extern/include/boost/unordered_map.hpp:17,
from char.h:4,
from char_skill.cpp:7:
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:262:34: note: 'const VID' is not derived from 'const std::unique_ptr<_Tp, _Dp>'
return hash_value(val);
^
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp: In member function 'std::size_t boost::hash<T>::operator()(const T&) const [with T = VID; std::size_t = unsigned int]':
/usr/src/blabla/Extern/include/boost/functional/hash/extensions.hpp:263:9: warning: control reaches end of non-void function [-Wreturn-type]
}
^
gmake: *** [OBJDIR/char_skill.o] Error 1
I don't know why I have this problem :x
PS : If anyone know how to install boost-all (1.5.7 or +) using freebsd ^^
Have a nice day :)

Objective-C++ ARC and C++ containers

I'm trying to compile my legacy-free libFoundation project, located at https://github.com/chmeeedalf/lf-foundation but running into problems using clang 3.4 and libc++. It appears something is not happy with ARC in the containers, and I see the following error excerpt:
In file included from /home/chmeee/git-lffoundation/src/Collections/NSCoreArray.mm:34:
In file included from /home/chmeee/git-lffoundation/src/../Headers/Foundation/NSArray.h:31:
In file included from /home/chmeee/git-lffoundation/src/../Headers/Foundation/NSObject.h:40:
In file included from /home/chmeee/git-lffoundation/src/../Headers/Foundation/NSRange.h:192:
In file included from /usr/include/c++/v1/algorithm:627:
/usr/include/c++/v1/memory:913:17: error: call to 'addressof' is ambiguous
{return _VSTD::addressof(__r);}
^~~~~~~~~~~~~~~~
/usr/include/c++/v1/__config:341:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
^
/usr/include/c++/v1/vector:1678:65: note: in instantiation of member function 'std::__1::pointer_traits<const __strong id *>::pointer_to' requested here
const_pointer __xr = pointer_traits<const_pointer>::pointer_to(__x);
^
/home/chmeee/git-lffoundation/src/Collections/NSCoreArray.mm:115:8: note: in instantiation of member function 'std::__1::vector<id, std::__1::allocator<id> >::insert' requested here
items.insert(items.begin() + index, anObject);
^
/usr/include/c++/v1/__functional_base:96:1: note: candidate function [with _Tp = const id]
addressof(__strong _Tp& __x) _NOEXCEPT
^
/usr/include/c++/v1/__functional_base:122:1: note: candidate function [with _Tp = const id]
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
^
/usr/include/c++/v1/__functional_base:83:1: note: candidate function [with _Tp = const id]
addressof(_Tp& __x) _NOEXCEPT
^
1 error generated.
*** Error code 1
Stop.
make: stopped in /home/chmeee/git-lffoundation/src
Exit 1
The file in this example has a std::vector declared as:
std::vector<id> items;
Can someone shed some light onto this problem? I tried adding an explicit __strong in the std::vector declaration, to no avail, however __unsafe_unretained does eliminate the error.
I'm building on FreeBSD -CURRENT, using the libc++ and clang 3.4 that is in base.
Answering my own question, in case others are interested. Clang defines __weak as a preprocessor macro for ARC. However, FreeBSD's <sys/cdefs.h> also defines __weak itself. The workaround I found for this was to add to my local <sys/cdefs.h>:
#ifndef __weak
#define __weak what_freebsd_defines_ass
#endif