Go Down

Topic: WProgram.h: No such file or directory (Read 222238 times) previous topic - next topic


I'm new to Arduino to. I'm having exactly the same problem. I'm going to reread this tomorrow and try and figure it out once and for all. :smiley-confuse:


Good Afternoon. I'm trying to do the project called "Ultrasonic Alarm" corresponding to page 333 of the same book: http://www.fema.com.br/arduino/wp-content/uploads/2014/08/arduino.pdf
In this project I use the "LV-MaxSonar EZ3 *" but at the code for the Arduino asks me the following error:

In file included from sketch_mar13a.ino: 1: 0:
C: \ Users \ admin \ Documents \ Arduino \ libraries \ LedControl / LedControl.h: 24: 22: fatal error: WProgram.h: No such file or directory
  #include <WProgram.h>
compilation terminated.
Error compiling.

I would like to help me solve this problem. thank you


Where it says WProgram.h in your scetch put Arduino.h instead.


Where it says WProgram.h in your scetch put Arduino.h instead.
Better late than never, I guess...
The art of getting good answers lies in asking good questions.


You probably have to change the permissions on the library folder. Go to the Arduino Library folder and right click -> Properties. Select the Security Tab, Click "Advanced". You'll probably see that Users have only "Read & Execute" permissions if you are not an administrator. You need to change the permission to  "Full Control".


Did you bother to read the thread, jb8ker? WProgram.h is not used in the Arduino IDE/SDK anymore.


Correct. I did read (most) of the thread. I understand that WProgram.h is no longer used. I'm saying that is likely not allowing him to save or make the change in the .cpp file because he doesn't have the permissions set correctly. I find this happens often on my work computer, where folders in Program Files are defaulted to have permissions of "Read Only". You need to manually change the permissions of the library folders so that you have full control.


Assuming the issue is still " missing WProgram.h" and not some OS permissions issue.

Beauty of software that there are many different ways to accomplish the task.

In this case you can be "cut and paste"  hacker and replace WProgram.h with Arduino.h because some alleged authority said so or you can be on your way to became real pro ( learn preprocessor ) and add what is missing in the long forgotten and abandoned "library":
 #ifdef ARDUINO
    #if ARDUINO < 100
        #include "WProgram.h"
        #include "Arduino.h"

Your choice.


Oct 27, 2016, 07:24 am Last Edit: Oct 27, 2016, 07:37 am by Nick Gammon Reason: Removed bold.
since the Bounce.cpp in libraries/Bounce folder is read only u can not modify it...

Rather u can try moving the Bounce folder to desktop ...

Remove the Read-only permissions in properties of the Bounce folder as well for the Bounce.cpp...

now open the Bounce.cpp in notepad and modify the first header file #include "WProgram.h" to #include "Arduino.h" and save..

now move the Bounce folder to the libraries section again...

The above procedure worked for me :)


 warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 Password password = Password( "1234" );

how can i solve this error in arduino software


WProgram.h is a hangover from the pre arduino 100 and was replaced with Arduino.h

So in order be compatible with both now and old arduino versions


#include <WProgram.h>


#if (ARDUINO <  100)
  #include <WProgram.h>
  #include <Arduino.h>

Go Up