lolob
February 19, 2016, 9:15am
1
Bonjour,
je dois réaliser un programme mais n'arrive pas à résoudre l'erreur de compilation. Merci d'avance pour votre aide.
Le message d'erreur est le suivant:
Arduino : 1.6.7 (Windows 10), Carte : "Arduino/Genuino Uno"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\user\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -ide-version=10607 -build-path "C:\Users\user\AppData\Local\Temp\buildef7b19ed9d080a6ee494ab51cb49f6f5.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "C:\Users\user\Documents\Arduino\pg_de_base\pg_de_base.ino"
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware "C:\Program Files (x86)\Arduino\hardware" -tools "C:\Program Files (x86)\Arduino\tools-builder" -tools "C:\Program Files (x86)\Arduino\hardware\tools\avr" -built-in-libraries "C:\Program Files (x86)\Arduino\libraries" -libraries "C:\Users\user\Documents\Arduino\libraries" -fqbn=arduino:avr:uno -ide-version=10607 -build-path "C:\Users\user\AppData\Local\Temp\buildef7b19ed9d080a6ee494ab51cb49f6f5.tmp" -warnings=all -prefs=build.warn_data_percentage=75 -verbose "C:\Users\user\Documents\Arduino\pg_de_base\pg_de_base.ino"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -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" "C:\Users\user\AppData\Local\Temp\buildef7b19ed9d080a6ee494ab51cb49f6f5.tmp\sketch\pg_de_base.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -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:\Users\user\Documents\Arduino\libraries\SimpleTimer.cpp" "C:\Users\user\AppData\Local\Temp\buildef7b19ed9d080a6ee494ab51cb49f6f5.tmp\sketch\pg_de_base.ino.cpp" -o "nul"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -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:\Users\user\Documents\Arduino\libraries\SimpleTimer.cpp" "C:\Users\user\AppData\Local\Temp\buildef7b19ed9d080a6ee494ab51cb49f6f5.tmp\sketch\pg_de_base.ino.cpp" -o "C:\Users\user\AppData\Local\Temp\buildef7b19ed9d080a6ee494ab51cb49f6f5.tmp\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Users\user\Documents\Arduino\libraries\SimpleTimer.cpp/SimpleTimer.h:27:0,
from C:\Users\user\Documents\Arduino\libraries\SimpleTimer.cpp/SimpleTimer.h:27,
(une cinquantaine de fois cette ligne!!)
from C:\Users\user\Documents\Arduino\pg_de_base\pg_de_base.ino:28:
C:\Users\user\Documents\Arduino\libraries\SimpleTimer.cpp/SimpleTimer.h:27:25: error: #include nested too deeply
#include "SimpleTimer.h"
^
Utilisation de la bibliothèque SimpleTimer.cpp prise dans le dossier : C:\Users\user\Documents\Arduino\libraries\SimpleTimer.cpp (legacy)
exit status 1
Erreur lors de la compilation.
On dirait un .h qui fait référence à lui même.
Ce n'est pas une librairie standard, tu l'as récupéré où cette librairie?
Y-a-t-il bien les lignes suivantes vers le début du .h?
#ifndef SIMPLETIMER_H
#define SIMPLETIMER_H
Ce serait bien aussi de nous mettre ton code.
acldup
April 16, 2016, 3:47pm
3
Bonjour,
j'ai le même problème, que je n'arrive pas à résoudre, le programme de la bibliothèque est le suivant:
/*
SimpleTimer.cpp
SimpleTimer - A timer library for Arduino.
Author: mromani@ottotecnica.com
Copyright (c) 2010 OTTOTECNICA Italy
This library is free software; you can redistribute it
and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software
Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser
General Public License along with this library; if not,
write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "SimpleTimer.h"
// Select time function:
//static inline unsigned long elapsed() { return micros(); }
static inline unsigned long elapsed() { return millis(); }
SimpleTimer::SimpleTimer() {
unsigned long current_millis = elapsed();
for (int i = 0; i < MAX_TIMERS; i++) {
enabled = false;
_ callbacks = 0; // if the callback pointer is zero, the slot is free, i.e. doesn't "contain" any timer _
prev_millis = current_millis;
_ numRuns = 0;
* }
numTimers = 0;
}
void SimpleTimer::run() {
int i;_
unsigned long current_millis;
_ // get current time*
* current_millis = elapsed();
for (i = 0; i < MAX_TIMERS; i++) {*
toBeCalled = DEFCALL_DONTRUN;
* // no callback == no timer, i.e. jump over empty slots*
if (callbacks*) {
// is it time to process this timer ?
// see - define variables, `ugly` initialisation - - #9 by system - Programming Questions - Arduino Forum
if (current_millis - prev_millis >= delays*) {*
* // update time*
//prev_millis = current_millis;
prev_millis += delays*;*
* // check if the timer callback has to be executed*
_ if (enabled*) {
// "run forever" timers must always be executed*
if (maxNumRuns == RUN_FOREVER) {
toBeCalled = DEFCALL_RUNONLY;
* }
// other timers get executed the specified number of times*
else if (numRuns < maxNumRuns*) {*
toBeCalled = DEFCALL_RUNONLY;
numRuns*++;
// after the last run, delete the timer*
if (numRuns >= maxNumRuns*) {*
toBeCalled = DEFCALL_RUNANDDEL;
* }
}
}
}
}
}_
for (i = 0; i < MAX_TIMERS; i++) {
_ switch(toBeCalled ) {_
case DEFCALL_DONTRUN:
_ break;_
case DEFCALL_RUNONLY:
_ (callbacks )();
* break;_
case DEFCALL_RUNANDDEL:
_ (callbacks )();
* deleteTimer(i);
break;
}
}
}
// find the first available slot*
// return -1 if none found
int SimpleTimer::findFirstFreeSlot() {
* int i;
// all slots are used*
* if (numTimers >= MAX_TIMERS) {*
* return -1;
}
// return the first slot with no callback (i.e. free)_
for (i = 0; i < MAX_TIMERS; i++) {
_ if (callbacks == 0) {
return i;
}
}
// no free slots found*
* return -1;
}
int SimpleTimer::setTimer(long d, timer_callback f, int n) {
int freeTimer;
freeTimer = findFirstFreeSlot();
if (freeTimer < 0) {
return -1;
}
if (f == NULL) {
return -1;
}
delays[freeTimer] = d;
callbacks[freeTimer] = f;
maxNumRuns[freeTimer] = n;
enabled[freeTimer] = true;_
prev_millis[freeTimer] = elapsed();
_ numTimers++;
return freeTimer;
}_
int SimpleTimer::setInterval(long d, timer_callback f) {
return setTimer(d, f, RUN_FOREVER);
_ }_
int SimpleTimer::setTimeout(long d, timer_callback f) {
return setTimer(d, f, RUN_ONCE);
_ }
void SimpleTimer::deleteTimer(int timerId) { _
if (timerId >= MAX_TIMERS) {
_ return;
}
// nothing to delete if no timers are in use*
* if (numTimers == 0) {
return;
}
// don't decrease the number of timers if the*
* // specified slot is already empty*
* if (callbacks[timerId] != NULL) {
callbacks[timerId] = 0;
enabled[timerId] = false;_
toBeCalled[timerId] = DEFCALL_DONTRUN;
_ delays[timerId] = 0;
numRuns[timerId] = 0;
// update number of timers*
* numTimers--;
}
}
// function contributed by code@rowansimms.com *
void SimpleTimer::restartTimer(int numTimer) {
* if (numTimer >= MAX_TIMERS) {*
* return;
}_
prev_millis[numTimer] = elapsed();
_ }
boolean SimpleTimer::isEnabled(int numTimer) { _
if (numTimer >= MAX_TIMERS) {
_ return false;
}
return enabled[numTimer];
}
void SimpleTimer::enable(int numTimer) { _
if (numTimer >= MAX_TIMERS) {
_ return;
}
enabled[numTimer] = true;
}
void SimpleTimer::disable(int numTimer) { _
if (numTimer >= MAX_TIMERS) {
_ return;
}
enabled[numTimer] = false;
}
void SimpleTimer::toggle(int numTimer) { _
if (numTimer >= MAX_TIMERS) {
_ return;
}
enabled[numTimer] = !enabled[numTimer];
}
int SimpleTimer::getNumTimers() {
return numTimers;
}*
j'ai exactement le même message d'erreur, merci d'avance pour votre aide! _