[SOLVED]Is it possible to use a library from a .cpp file in a multi-file sketch?

Hi everyone,

I'm trying to use an Arduino library from a .cpp file in my multi-file sketch, but the #include fails with the error message "no such file or directory".

In my .cpp file I have the following #include statements in the very beginning:

#include <Arduino.h>
#include <Adafruit_GPS.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM303_U.h>
#include <Adafruit_L3GD20_U.h>
#include <Wire.h>
#include <SoftwareSerial.h>

But I get the error message:

sensors.cpp:2:26: fatal error: Adafruit_GPS.h: No such file or directory
#include <Adafruit_GPS.h>
^
compilation terminated.
Error compiling.

I have tried moving the include statements into my .ino file (main file), but with no success.
I have also tried changing the angular brackets to quotation marks, but also with no success.
I have also tried moving the library into my sketch directory, and using relative paths in the #include, but also with no success.

I'm using the standard Arduino IDE version 1.6.4 on Linux.

Am I overlooking something, or is it just not possible to use libraries from .cpp files?

Thanks,

Troels

I have tried moving the include statements into my .ino file (main file), but with no success.

That's because you need to COPY the include statement, not MOVE it.

Ah, I see. Got it working now, thanks!