ARDUINO 1.0 - error: WConstants.h: No such file or directory

Hello,

the script below used to work with Arduino 0016.Now with hardware the Arduino UNO and Arduino 1.0 I get the error:

/Applications/Arduino.app/Contents/Resources/Java/libraries/E24C1024/E24C1024.h:47:24: error: WConstants.h: No such file or directory

that you see in attached image.
Can you please advise what changes I should do - probably with the libraries..many thanks

#include <WProgram.h>
#include <Wire.h>
#include <E24C1024.h>
#include <EEPROM.h>
byte inByte;   // Where to store the Bytes read
int ledPin = 13;  // Set the pin to digital I/O
int index = 0;
int addr = 0;
int pass = 0;

void setup()
{
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available() > 0)
  {
    inByte = Serial.read(); // Read a Byte
      int val = inByte;
      EEPROM1024.write(addr, val);
      addr = addr + 1;
      if (addr == 676)
      addr = 0;
      Serial.print("At the position ");
      Serial.print(index);
      Serial.print("  arduino received: ");
      Serial.println(inByte,DEC);  
      index++;
      Serial.print("At the position ");
      Serial.print(addr-1);
      Serial.print(" of EEPROM I wrote: ");
      Serial.print(val,DEC);
      Serial.println();
  }
}

ARDUINO_BUG01.jpg

btw I have already changed the first line to:

#include <Arduino.h>

instead of

#include <WProgram.h>

but I still get the error.

any hint highly appreciated.

The compiler is telling you the file that is causing the problem. Change the include statement in that file to include Arduino.h, instead.

many thanks!!!this is fixed but I still get many errors.
They has to do with the replacement of send() and receive() with read() and write().
But in which file do I substitute this code?In which file should I substitute send() for read()?

I also don't understand the first error:

/Applications/Arduino.app/Contents/Resources/Java/libraries/E24C1024/E24C1024.cpp: In static member function 'static void E24C1024::write(long unsigned int, uint8_t)':

any help very appreciated.

ARDUINO_BUG02.jpg

Below is the code of wire.h but where are the files inttypes.h & Stream.h located? Are in these files the send() & receive() that have to be replaced?thx!

#ifndef TwoWire_h
#define TwoWire_h

#include <inttypes.h>
#include "Stream.h"

#define BUFFER_LENGTH 32

class TwoWire : public Stream
{
  private:
    static uint8_t rxBuffer[];
    static uint8_t rxBufferIndex;
    static uint8_t rxBufferLength;

    static uint8_t txAddress;
    static uint8_t txBuffer[];
    static uint8_t txBufferIndex;
    static uint8_t txBufferLength;

    static uint8_t transmitting;
    static void (*user_onRequest)(void);
    static void (*user_onReceive)(int);
    static void onRequestService(void);
    static void onReceiveService(uint8_t*, int);
  public:
    TwoWire();
    void begin();
    void begin(uint8_t);
    void begin(int);
    void beginTransmission(uint8_t);
    void beginTransmission(int);
    uint8_t endTransmission(void);
    uint8_t requestFrom(uint8_t, uint8_t);
    uint8_t requestFrom(int, int);
    virtual size_t write(uint8_t);
    virtual size_t write(const uint8_t *, size_t);
    virtual int available(void);
    virtual int read(void);
    virtual int peek(void);
	virtual void flush(void);
    void onReceive( void (*)(int) );
    void onRequest( void (*)(void) );
  
    using Print::write;
};

extern TwoWire Wire;

#endif

Your problem should be solved if you look up this solution at https://sites.google.com/site/kingauswebpage/my-projects/cannot-find-wconstants-h
:slight_smile:
"When compile an Arduino Library, it fails to compile with the message:
error: WConstants.h: No such file or directory
The solution is to delete the line
#include "WConstants.h"
and then in the .h file, add the following:
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
This way, the code will compile, and it will be compatible to Arduino 0023 and 1.0 versions."

Wow that last post saved my butt,on hat one finally got Timer2 test to compile

Yes you have to type #include <Arduino.h> instead #include <WProgram.h> or #include <WStructure.h>
I did this modifications in JArduino projects, that's amazing ....

The file revisions.txt in the top level of the Arduino distribution chronicals all the changes
between versions - normally you would glance through this when you install a newer
version to see what's changed - you'll see all these changes are mentioned.

their has problem with ps2dev library
C:\Users\COMPAQ\Documents\Arduino\libraries\ps2dev/ps2dev.h:12:24: fatal error: WConstants.h: No such file or directory what should i do
thank u

what should i do

Instead of just finding this thread and tacking the same question on the end, try actually reading the thread.