Pages: [1]   Go Down
Author Topic: ARDUINO 1.0 - error: WConstants.h: No such file or directory  (Read 19503 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Operation BC means Operation BLACK CAT
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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 (61.78 KB, 501x105 - viewed 228 times.)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Operation BC means Operation BLACK CAT
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

btw I have already changed the first line to:

Code:
#include <Arduino.h>


instead of

Code:
#include <WProgram.h>

but I still get the error.

any hint highly appreciated.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Operation BC means Operation BLACK CAT
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (257.38 KB, 506x322 - viewed 301 times.)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Operation BC means Operation BLACK CAT
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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
« Last Edit: January 02, 2012, 04:48:18 pm by cyberCulture » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: