Sorry, still not working... it does only if you don't nest another folder =(
For example:
in ~/libraries there is the folder: "LibreriaA"
that contains:
Classe.cpp
Classe.h
folder "sottoclassi"
witch contains:
Sottoclasse.h
Sottoclasse.cpp
Sottoclasse has only one public method update:
Sottoclasse.h
#ifndef Sottoclasse_h
#define Sottoclasse_h
class Sottoclasse{
public:
void update();
private:
};
#endif
Sottoclasse.cpp
#inlude "Sottoclasse.h"
void Sottoclasse::update(){
}
Classe has a variable Sottoclasse and an update method that call the update on Sottoclasse
Classe.h
#ifndef Classe_h
#define Classe_h
#import "sottoclassi/Sottoclasse.h"
class Classe{
public:
void update();
private:
Sottoclasse temp;
};
#endif
Classe.cpp
#import "Classe.h"
void Classe::update(){
temp.update();
}
Now, in in my .pde i declare Classe:
#include <Classe.h>
Classe tmp;
void setup(){
}
void loop(){
}
everything run fine
but if I try to use update()...
#include <Classe.h>
Classe tmp;
void setup(){
tmp.update();
}
void loop(){
}
I've got a compilation error:
LibreriaA/Classe.cpp.o: In function Classe::update()': ~/sketchbook/libraries/LibreriaA/Classe.cpp:4: undefined reference to
Sottoclasse::update()'
collect2: ld returned 1 exit status
include sottoclasse does not do the trick:
#include <sottoclassi/Sottoclasse.h>
same error.
I've also tryed to inizialize the classes, with a constructor in Classe.cpp (and it's declaration in Classe.h)
Classe::Classe(){
temp = Sottoclasse();
}
and in the .pde:
#include <Classe.h>
#include <sottoclassi/Sottoclasse.h>
Classe tm;
void setup(){
tmp = Classe();
tmp.update();
}
void loop(){
}
compilation output:
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/hardware/arduino/cores/arduino -I~/sketchbook/libraries/LibreriaA /tmp/build3895633309484179111.tmp/sketch_apr28a.cpp -o/tmp/build3895633309484179111.tmp/sketch_apr28a.cpp.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino -I~/sketchbook/libraries/LibreriaA -I~/sketchbook/libraries/LibreriaA/utility ~/sketchbook/libraries/LibreriaA/Classe.cpp -o/tmp/build3895633309484179111.tmp/LibreriaA/Classe.cpp.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/wiring_shift.c -o/tmp/build3895633309484179111.tmp/wiring_shift.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/wiring_digital.c -o/tmp/build3895633309484179111.tmp/wiring_digital.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/wiring.c -o/tmp/build3895633309484179111.tmp/wiring.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/wiring_analog.c -o/tmp/build3895633309484179111.tmp/wiring_analog.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/pins_arduino.c -o/tmp/build3895633309484179111.tmp/pins_arduino.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/wiring_pulse.c -o/tmp/build3895633309484179111.tmp/wiring_pulse.c.o
avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/WInterrupts.c -o/tmp/build3895633309484179111.tmp/WInterrupts.c.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/Tone.cpp -o/tmp/build3895633309484179111.tmp/Tone.cpp.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/WMath.cpp -o/tmp/build3895633309484179111.tmp/WMath.cpp.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/WString.cpp -o/tmp/build3895633309484179111.tmp/WString.cpp.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/Print.cpp -o/tmp/build3895633309484179111.tmp/Print.cpp.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/main.cpp -o/tmp/build3895633309484179111.tmp/main.cpp.o
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=22 -I~/arduino-0022/hardware/arduino/cores/arduino ~/arduino-0022/hardware/arduino/cores/arduino/HardwareSerial.cpp -o/tmp/build3895633309484179111.tmp/HardwareSerial.cpp.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/wiring_shift.c.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/wiring_digital.c.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/wiring.c.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/wiring_analog.c.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/pins_arduino.c.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/wiring_pulse.c.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/WInterrupts.c.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/Tone.cpp.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/WMath.cpp.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/WString.cpp.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/Print.cpp.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/main.cpp.o
avr-ar rcs /tmp/build3895633309484179111.tmp/core.a /tmp/build3895633309484179111.tmp/HardwareSerial.cpp.o
avr-gcc -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build3895633309484179111.tmp/sketch_apr28a.cpp.elf /tmp/build3895633309484179111.tmp/sketch_apr28a.cpp.o /tmp/build3895633309484179111.tmp/LibreriaA/Classe.cpp.o /tmp/build3895633309484179111.tmp/core.a -L/tmp/build3895633309484179111.tmp -lm
HELP 