Compilation Error <limits>

I get the following error message upon compiling for the arduino uno platform.
On the contrary, the compilation is successfully for the arduino due platform.
Is there a compilation option?
Thanks. Guido

Detecting libraries used...
"C:\Programs\arduino-1.8.15\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Programs\arduino-1.8.15\hardware\arduino\avr\cores\arduino" "-IC:\Programs\arduino-1.8.15\hardware\arduino\avr\variants\standard" "C:\Users\cmu1269\AppData\Local\Temp\arduino_build_693651\sketch\MoCa.ino.cpp" -o nul
Alternatives for limits: []
ResolveLibrary(limits)
In file included from C:\Temp\FF\MoCa\MoCa.h:38:0,
-> candidates: []
from C:\Temp\FF\MoCa\MoCa.ino:20:
C:\Temp\FF\MoCa\src\lib\timer.h:6:10: fatal error: limits: No such file or directory
#include
^~~~~~~~
compilation terminated.
exit status 1
Errore durante la compilazione per la scheda Arduino Uno.

limits.h works on both Due a Uno; limits only works on the Due. No idea if there is a difference between the two.

All bold is considered shouting; and it's annoying to read. This migt be due to the # in the error messages that you posted; a good reason to post errors using code tags :wink:

Ops, sorry. The compiler complains about this statement:

C:\Temp\FF\MoCa\src\lib\timer.h:6:10: fatal error: limits: No such file or directory
....include

It seems to me that this is a compiler issue. Something in the 'environment' is not set correctly or is missing. Both versions 1.8.12/15 have the same behaviour.

I referred to code tags it's the </> button at the top of the reply window on this forum), not to pictures :wink:

I can't help you much but there are two totally different tool chains for the AVR boards and the Due; that is where the difference comes in. The AVR one clearly doesn't have limits, the Due one has.

I could not find a file limits for the Due, only limits.h; not being much of a C++ programmer, I don't know how it works.

They are different: <limits.h> is a C header, <limits> is a C++ header. If the code uses <limits>, it probably won't work by replacing it with <limits.h>.
On top of that, this is just the first error, even if you fix the <limits> problem, you'll just get more issues. If the code uses other C++ standard library features, it won't work on an AVR-based Arduino. There are ways to get the standard library working on AVR, but that doesn't guarantee that the code will work as expected or that an Uno will have enough memory.

1 Like

I understand that :wink:

Any idea where I can find the limits file on my PC; I did search the Due 'installation' as well as the AVR 'installation' and only found limits.h.

Agent Ransack to the rescue. In one of my "portable" Arduino IDE installations it's in these directories:

...\portable\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-97-gc752ad5-5.2.0\xtensa-esp32-elf\include\c++\5.2.0

...\portable\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-4-b40a506\xtensa-lx106-elf\include\c++\4.8.2

...\portable\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3

...\portable\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4\arm-none-eabi\include\c++\7.2.1

I also have a portable install (for a Wemos D1) and can find it there in Windows file eplorer. However in my normal install for Due (and AVR), I can't find it :frowning:

For the Arduino Due, 'limits' is in:
C:\Users\xxxxx\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\c++\4.8.3\limits.

1 Like

Thank you; I have to get new glasses ( again :frowning: )

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.