Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
int flush() in aJsonStream overrides void flush() in Print #89
It looks like aJsonStream.flush() returns an int, but is trying to override Print.flush() which returns void.
I'm getting compile errors with arduino 1.8.3:
Changing aJsonStream.flush() so it doesn't return anything fixes the problem, but not sure if it might create other problems.
FWIW, I created a patch for this. I also checked the aJson code and no one is calling flush so it shouldn't hurt the library. Any application code checking the return code of flush might be affected but it's an easy fix - don't check the return code (it doesn't tell you anything useful anyway).
Patch can be found here: https://gitlab.com/xarduino/lightsw/blob/master/patch/ajson-void-flush.patch
Arduino:1.8.5 (Windows 10), 开发板："Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
In file included from D:\360瀹夊叏娴忚鍣ㄤ笅杞絓aJson-master (1)\aJson-master\Examples\Json_Serial\Json_Serial.ino:19:0:
aJSON.h:92: error: conflicting return type specified for 'virtual int aJsonStream::flush()'
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26:0,
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:90:18: error: overriding 'virtual void Print::flush()'
exit status 1
在文件 -> 首选项开启