Go Down

Topic: IDE can?t fine library includes (Read 3004 times) previous topic - next topic

bullethole

I;m using the "softD1307" code in a project.  If i use the example code it properly finds the library includes for "SoftI2cMaster".  However when I move the code over to my project, the compiler complains that it cant; find SoftIc2Master.h TWIMaster.h.

If i copy the library code into my sketch directory all works fine.  Normaly this would indicate (in a Makefile world) that I don't have the search paths set up, but I cant figure out how to force the IDE to do this.

retrolefty

#1
Aug 22, 2010, 07:43 pm Last Edit: Aug 22, 2010, 07:44 pm by retrolefty Reason: 1
You need to create a folder called libraries in your Arduino sketch directory and in there can be placed user library folders. Here is an example of where my user library folders are held so that the Arduino IDE can find them.

Quote
C:\Documents and Settings\Primary Windows User\My Documents\Arduino\libraries

9 Folders:

Button
DS1307
Flash
MsTimer2
Streaming
String
Tone
WString
__MACOSX


0 Files:


Lefty

bullethole

I already have the SoftI2cMaster and TwiMaster libraries in the library directory

#include "some_lib.h"

... with double-quotes expects the file to be in the current folder.

#include <some_lib.h>

... with angle brackets will look for the file in a "libraries" folder.

Hope that's useful.

Prawnhead
There are 3 kinds of people in the world. Those who are good at maths, and those who aren't.

bullethole

Actually,  in the C language,  " means search local directories first, then the include path.   <> (chickenlips) means to search only the include path.   I have the includes correct.  if this was a makefile i'd just add the  -I <pathname> to the CC invocation.

PaulS

Where did you tell us what operating system you are using? Where did you tell us what version of the IDE you are using?

In the IDE, the Sketch + Import Library... menu item will list all libraries installed in the correct location(s). Are the libraries you are having difficulties with in that list?

bullethole

Version 18 of the IDE,  both Windows and MAC OSX.   The libraries do not show up in the list, which is strange because for all the other libraries which are working, i  just put the directories into the libraries directory.

Note, the softD1307 sample sketch finds the libraries correctly, but my sketch does not.  Again.. quite weird.  unfortunately I'm traveling and don't have the code with me at this time.

PaulS

The simplest solution, then, is to note one of the library names that Sketch + Import Library... shows, and search on your computer for a folder with that name. Put the folders containing that libraries that you can't import into the folder that Import Library... can access.

bullethole

It is in the directory where the others are.  I think the problem is with including the files in a cpp file which i have as part of my sketch directory.  I will experiment with some test.code


bullethole

As i have made the softD1307 a library a set of objects and methods, I have named my file softD1307.cpp.  With this, the paths are not found for the libraries.  When I change the name to softD1307.pde  i no longer get include errors.  So something is strange in the IDE when the file is a cpp and how paths are searched.

Go Up