including a library from a cpp

I'm trying to use Wire.h in a multisketch project. I have a cpp file that must use Wire.h but I cannot include it. I always get "No such file or directory"

I tried

#include <Wire.h>
#include "Wire/Wire.h"
#include <Wire/Wire.h>

#include <libraries/Wire/Wire.h>
#include "libraries/Wire/Wire.h"

#include <../libraries/Wire/Wire.h>
#include "../libraries/Wire/Wire.h"

but no luck. How am i suppose to use libraries from cpp files?

ecerulm--

Does #include <eeprom.h> work? If so, then make sure you have put the wire.h library in exactly the same spot as (parallel to) the eeprom library. What is a "multisketch" project? One with multiple tabs?

#include <eeprom.h> doesn't work either. Both includes work if I put them in the pde file. But they don't work if I put them in a cpp file.

And yes, mikalhart, I mean multiple tabs.

It may be a naming issue. Name both modules *.pde instead of *.cpp. I made a quick sketch that has two pde files:

extern int foo;
extern void fun();
void loop(){}
void setup(){
fun();
Serial.begin(9600);
Serial.println(foo);
}

and

#include <EEPROM.h>

int foo = 22;

void fun()
{
  foo = EEPROM.read(0);
}

This worked for me. Case may matter in #includes too.

Mikal

It seems that if I add

#include <Wire.h>

to the.pde file (the main sketch file) then the #include <Wire.h> in the cpp file works.

http://www.arduino.cc/en/Hacking/BuildProcess says that the include path include library directories which contain a header file which is included by the main sketch file. So I guess that including Wire.h in the main sketch file is the way to go if I need Wire.h in the cpp file.

The include path includes the sketch's directory, the target directory (/hardware/core//) and the avr include directory (/hardware/tools/avr/avr/include/), as well as any library directories (in /hardware/libraries/) which contain a header file which is included by the main sketch file.

This thread (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1224470702) talks about the same issue. You have to add the library to the main pde file, it's the way it works.