Go Down

Topic: ARDUINO 1.0 - error: WConstants.h: No such file or directory (Read 23040 times) previous topic - next topic

Operation BC

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

Code: [Select]
#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();
  }
}

Operation BC

btw I have already changed the first line to:

Code: [Select]
#include <Arduino.h>

instead of

Code: [Select]
#include <WProgram.h>

but I still get the error.

any hint highly appreciated.

PaulS

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

Operation BC

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.

Operation BC

#4
Jan 02, 2012, 10:46 pm Last Edit: Jan 02, 2012, 10:48 pm by cyberCulture Reason: 1
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!


Code: [Select]

#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

anshulvj

Your problem should be solved if you look up this solution at https://sites.google.com/site/kingauswebpage/my-projects/cannot-find-wconstants-h
:)
"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."

Mrod

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

walterp

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 ....

MarkT

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.
[ I won't respond to messages, use the forum please ]

Go Up