wiring.h:130:18: error

Status
Not open for further replies.

niemans

New member
Hi everybody,
I am a beginner with teensy and I can not compile the code, it seems it comes from the round function.
I tried to put #undef round at the beginning of the sketch but it does not fix the problem like in this post:
https://forum.pjrc.com/threads/35391-Error-Compling-for-board-Teensy-3-2-3-1?highlight=wiring.h
Any suggestion to help me?

Arduino: 1.0.6 + Td: 1.40 (Windows 7), Board: "Teensy 3.2 / 3.1"
C:\Program Files (x86)\Arduino\hardware\tools\arm\bin\arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -mthumb -nostdlib -D__MK20DX256__ -DTEENSYDUINO=140 -fsingle-precision-constant -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_US_ENGLISH -IC:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3 C:\Users\ADMINI~1.L01\AppData\Local\Temp\build8633845452776636123.tmp\SoftKeyboard.cpp -o C:\Users\ADMINI~1.L01\AppData\Local\Temp\build8633845452776636123.tmp\SoftKeyboard.cpp.o In file included from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Printable.h:25:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Print.h:39,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Stream.h:24,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/HardwareSerial.h:246,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/WProgram.h:46,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Arduino.h:3,
from SoftKeyboard.ino:6:
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/new.h:41:6: warning: 'void operator delete(void*, size_t)' is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Wc++14-compat]
void operator delete(void * ptr, size_t size);
^
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/new.h:42:6: warning: 'void operator delete [](void*, size_t)' is a usual (non-placement) deallocation function in C++14 (or with -fsized-deallocation) [-Wc++14-compat]
void operator delete[](void * ptr, size_t size);
^
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/WProgram.h:45:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/Arduino.h:3,
from SoftKeyboard.ino:6:
C:\Program Files (x86)\Arduino\hardware\teensy\cores\teensy3/wiring.h:130:18: error: statement-expressions are not allowed outside functions nor in template-argument lists
#define round(x) ({ \
^
SoftKeyboard.ino:28:23: note: in expansion of macro 'round'
SoftKeyboard.ino: In function 'void sample(float, int, float, float, float, int)':
SoftKeyboard.ino:330:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:347:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:357:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:376:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:384:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:410:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:421:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:430:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
SoftKeyboard.ino:440:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 

Attachments

  • SoftKeyboard.ino
    14 KB · Views: 74
Hello,

simple and fast solution:

change "int quietTimeMillis = round(quietTime*1000.0);" into "int quietTimeMillis = 200;"

then "quietTimeMillis" is still initalized and both variables are near to each other in code so you can change "quietTimeMillis" if you change the value of "quietTime".
Not elegant, but should work.
 
Your sketch with the added "#undef round" compiles without errors using arduino 1.8.5 & teensyduino 1.40 on mac osx.
I would suggest to update your arduino installation.
 
Your sketch with the added "#undef round" compiles without errors using arduino 1.8.5 & teensyduino 1.40 on mac osx.
I would suggest to update your arduino installation.

I saw the same, but did it in a safer way (Arduino 1.8.5, Teensyduino 1.41):
Code:
#ifdef round
#undef round
#endif
 
So I installed Arduino 8.4 and teensyduino 1.41.

I modified the beginning of the sketch as you said

Code:
#ifdef round
#undef round
#endif

and it works fine:)
Thanks again for your help.
 
Status
Not open for further replies.
Back
Top