Compiling Error Message

Hi.

I’m trying to build a traffic counter and found this project in the web. The code is here (it downloads a zip file).

I opened it in the arduino compiler and when I try to upload it, I get this error:

Arduino: 1.6.0 (Windows 7), Board:“Arduino Uno”

In file included from traffic_counter_software_v5.pde:17:0:
EEPROMAnything.h:1:22: fatal error: WProgram.h: No such file or directory
#include <WProgram.h>
^
compilation terminated.
Error compiling.

Now, the zip file the code comes in, has a “EEPROMAnything.h” file in it, so I don’t understand why that error…

Can anyone help with this please? Also, bear in mind I’m a complete 0 when it comes to programming…

Thanks :slight_smile:

Things have changed and that code is a few years old.

Try removing “#include <WProgram.h>” from “EEPROManything.h”.
I think that will not work, so replace it with the new name and use : “#include <Arduino.h>”

(deleted)

You can be a bad hacker or expert programmer by doing it right.

Check the “EEPROManything.h” for something similar to
#ifdef “Arduino < number” the version number MAY be small < 1
#include <Arduino .h>
#esle
#include <WProgram.h>
#endif

or just delete the #include<WProgram.h> whatever way it is included in that file.

Make sure you do not delete
#ifndef EEPROManything.h
#define EEPROManything.h

Or something similar , the name may be caps or hyphenated.

Than ADD
#include <Arduino.h> AS A VERY first line of code in your x.ino file for good measure ( it is there but invisible ) , before #include EEPROManything.h and you are done.

Hopefully there are no other references in your “libraries” to WProgram.h

You can be a bad hacker or expert programmer by doing it right.

Check the “EEPROManything.h” for something similar to
#ifdef “Arduino < number” the version number MAY be small < 1

Or you can be stupid by following any of Vaclav’s advice.

That is NOT how to test the version of the IDE. Not even close.

So basically I need to either remove the line “#include <WProgram.h>” or rename the file to “Arduino.h” and change in the code. Is that it?

PCanas:
So basically I need to either remove the line “#include <WProgram.h>” or rename the file to “Arduino.h” and change in the code. Is that it?

If the said line is in a .pde or .ino file, remove the line. If it is in a .h, .c, or .cpp file, replace it with Arduino.h

PaulS:
Or you can be stupid by following any of Vaclav’s advice.

That is NOT how to test the version of the IDE. Not even close.

No need to get upset over people giving irresponsible rubbish.

#if ARDUINO < 100
#include <WProgram.h>
#else  // ARDUINO
#include <Arduino.h>
#endif  // ARDUINO

BTW, mostly only 3rd party libraries that were updated a few years ago have these. New arduino libraries and newly updated libraries just include Arduino.h

It's in the .pde file, wich also has the whole code for the sensor. I removed the line and got even more error, apparently those EEPROM things are used more often in the code, wich means I'd have to refurbish the whole code...

I'll try to program something completely new, and try to learn something :slight_smile: