libraries INSIDE the main Sketch.

Because I work on Sketches from different computers and I often have difficulties with the "right" libraries, I wonder if it's possible to incorporate libraries in the main sketch. So there won't be any "#includes" anymore ...
If there IS a possibility : what's the best way to do this ?
(I down/upload my sketches to the cloud (dropbox).

Any help on this subject will be greatly appreciated.
thanks in advance.

Yes, just copy the code from the libraries into the sketch. Problem is that your source code becomes massively big.

It might be easier to either keep track where you downloaded the library from (e.g. as a comment in the sketch) or upload the libraries to the cloud so you can quickly download them when needed.

Can't you just add the library folder to your dropbox so you're using the same one across platforms as well?

Or you could copy the specific library files into your sketch folder. It will mean having multiple copies of the library files but they will always be connected directly to that specific sketch.

Thanks guys,

I did upload the libraries to the Cloud, and for the longest time, I could compile my sketch(es) on both computers. But all of a sudden, my sketch wouldn't compile anymore on computer A while computer B compiled (the SAME sketch!) without any problems. (ALL comps are Win7/64, ALL ide's are 1.6.11).
Both compilers DO use the libraries from the cloud.

I did overwrite the libs on the cloud with the libs from the comp that does compile with no problem, but still the same problem on computer A.

I'll try to upload the libs I use to the sketchfolder.
Do I put 'em in the main sketch folder or in the folder where the ".ino" is ?

Still I want to know what parts of the libraries and where I have to put in my main code. I understand that the source code will get big, but I'll be sure that the correct library(version) will be used, on whatever computer I work.

I noticed that "SD.h" is an evil-doer : when I don't compile it, it goes a little better, but then the compiler still doesn't find any sub routines (that are in the main sketch) anymore ...
weird weird weird ...

Anyhow ... thanks again guys! If there's anything more you could come up with : please lemme know. I also hope that other "Aduinists" will benefit from this Topic.

This looks like two different problems:

  1. Two installations which seem identical are doing different things.
  • You must keep looking to find what is different.
  1. Managing libraries and sketches.
  • Are you aware of the "libraries" folder inside your Arduino sketch folder?

Thanks for your reply, Morgan !

Copying the necesary libs into my sketch directory seems to be the best idea. If I need to send the file to someone, I just zip the whole folder.

Now I did copy the libraries that I need in my sketch in the directory where the .ino file is.
But when I compile, the IDE still uses the ones in my C: Although I closed all open ide's and started from the ino file in the cloud (see pic)...

Using library SD at version 1.0.8 in folder: C:\Program Files (x86)\Arduino\libraries\SD
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
Using library UTFT in folder: C:\Program Files (x86)\Arduino\libraries\UTFT (legacy)
Using library UTouch in folder: C:\Program Files (x86)\Arduino\libraries\UTouch (legacy)
Using library DS3231 in folder: C:\Program Files (x86)\Arduino\libraries\DS3231 (legacy)

(Meanwhile, the sketch compiles OK, but couldn't try it on another comp yet ...)

Again : tanx to all who think with me ... :slight_smile:

You need to change the includes in the main sketch

from

#include <somelibrary.h>

to

#include "somelibrary.h"

You also need to do that for (some of) the files in the library itself.

The effect is that the compiler will now first look in the sketch directory for the library files; if it can't find them it will look in the 'standard' directories.

Thanks alot * !

You're right *, I've read this somewhere. I tried it :

#include "SD.h" // Load SD card library
#include "SPI.h" // Load SPI Library
#include "Wire.h" // Load wire library I2C
#include "UTFT.h" // Screen
#include "UTouch.h"// Touch
#include <avr/pgmspace.h>
#include "DS3231.h" // Real TIme clock + second impuls

and got this back from the compiler :

Multiple libraries were found for "SPI.h"
Used: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Not used: C:\Program Files (x86)\Arduino\libraries\SPI
Multiple libraries were found for "Wire.h"
Used: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
Not used: C:\Program Files (x86)\Arduino\libraries\Wire
Using library SD at version 1.0.8 in folder: C:\Program Files (x86)\Arduino\libraries\SD
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire
Using library UTFT in folder: C:\Program Files (x86)\Arduino\libraries\UTFT (legacy)
Using library UTouch in folder: C:\Program Files (x86)\Arduino\libraries\UTouch (legacy)
Using library DS3231 in folder: C:\Program Files (x86)\Arduino\libraries\DS3231 (legacy)

The folder looks like this :
Dropbox > _SOLAR PANEL > SOLAR_SD_160910
Folder : DS3231
Folder : SD
Folder : SPI
Folder : UTFT
Folder : Utouch
Folder : Wire
File : SOLAR_SD_160910.ino

What did I do wrong ?

What did I do wrong ?

Why have you tried to add the Wire and SD libraries to your project? They are CORE libraries that you should NOT be copying all over the place.