# problem with #include \<WString.h\>

**URL:** <https://forum.arduino.cc/t/problem-with-include-wstring-h/48986>\
**Category:** Troubleshooting\
**Created:** [July 17, 2010, 11:24am UTC](https://forum.arduino.cc/t/problem-with-include-wstring-h/48986 "2010-07-17T11:24:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 17, 2010, 11:24am UTC](https://forum.arduino.cc/t/problem-with-include-wstring-h/48986/1 "2010-07-17T11:24:58Z")

</div>

hi  
i am trying to run this small program (shown below) but i keep getting an error when trying to compile it :  
21: error: WString.h: No such file or directory In function 'void loop()':  
Bad error line: -3  
what am i missing and yes i am a newbie.  
what do i need to add or change any help would appreciated  
thanks  
chilliman

#include \<WString.h\>  
#include \<Ethernet.h\>  
/\*  
Simple Ethernet Test

Arduino server outputs simple text to browser

The circuit:

- Arduino Duemilanove
- Arduino Ethernet shield
- Basic FTDI breakout 5V  
\*LED connected to GND and digital pin 4 via resistor

By Minde  
[http://www.sciencprog.com/](http://www.sciencprog.com/)  
\*/

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address  
byte ip[] = { 192, 168, 1, 177 }; // ip in lan  
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router  
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask  
Server server(80); //server port  
byte sampledata=50; //some sample data - outputs 2 (ascii = 50 DEC)  
int ledPin = 4; // LED pin  
char link[]="[http://www.scienceprog.com/](http://www.scienceprog.com/)"; //link data  
String readString = String(30); //string for fetching data from address  
boolean LEDON = false; //LED status flag  
void setup(){  
//start Ethernet  
Ethernet.begin(mac, ip, gateway, subnet);  
//Set pin 4 to output  
pinMode(ledPin, OUTPUT);  
//enable serial datada print  
Serial.begin(9600);  
}  
void loop(){  
// Create a client connection  
Client client = server.available();  
if (client) {  
while (client.connected()) {  
if (client.available()) {  
char c = client.read();  
//read char by char HTTP request  
if (readString.length() \< 30)  
{  
//store characters to string  
readString.append(c);  
}  
//output chars to serial port  
Serial.print(c);  
//if HTTP request has ended  
if (c == '\n') {  
//lets check if LED should be lighted  
if(readString.contains("L=1"))  
{  
//led has to be turned ON  
digitalWrite(ledPin, HIGH); // set the LED on  
LEDON = true;  
}else{  
//led has to be turned OFF  
digitalWrite(ledPin, LOW); // set the LED OFF  
LEDON = false;  
}  
// now output HTML data starting with standart header  
client.println("HTTP/1.1 200 OK");  
client.println("Content-Type: text/html");  
client.println();  
//set background to yellow  
client.print("");  
//send first heading  
client.println("

# HTTP test routines
");  
client.println("
* * *
");  
client.println("
* * *
");  
//output some sample data to browser  
client.println("Sample data: ");  
client.print(sampledata);//lets output some data  
client.println("  
");//some space between lines  
client.println("
* * *
");  
//drawing simple table  
client.println("Simple table: ");  
client.println("  
");  
client.println("");  
client.println("

| row 1, cell 1 | row 1, cell 2 |
| row 2, cell 1 | row 2, cell 2 |

");  
client.println("  
");  
client.println("
* * *
");  
//printing some link  
client.println("Link: ");  
client.print("Visit Scienceprog!");  
client.println("  
");  
client.println("
* * *
");  
//controlling led via checkbox  
client.println("
# LED control
");  
//address will look like [http://192.168.1.110/?L=1](http://192.168.1.110/?L=1) when submited  
client.println("LED  
");  
client.println("  
");  
//printing LED status  
client.print("LED status: ");  
if (LEDON)  
client.println("ON");  
else  
client.println("OFF");  
client.println("
* * *
");  
client.println("
* * *
");  
client.println("");  
//clearing string for next read  
readString="";  
//stopping client  
client.stop();  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 17, 2010, 11:57am UTC](https://forum.arduino.cc/t/problem-with-include-wstring-h/48986/2 "2010-07-17T11:57:12Z")

</div>

Have you installed the string library, and if so, where?

See the tutorial here:

> **[String() - Arduino Reference](https://www.arduino.cc/reference/en/language/variables/data-types/stringobject/)**
>
> The Arduino programming language Reference, organized into Functions, Variable and Constant, and Structure keywords.

(you didn't say what OS you're using, or which Arduino version)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 17, 2010, 1:52pm UTC](https://forum.arduino.cc/t/problem-with-include-wstring-h/48986/3 "2010-07-17T13:52:12Z")

</div>

thanks for the link, i am run windows 7 and arduino 0018 i will read the tutorial.

cjilliman 🙂

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 17, 2010, 2:01pm UTC](https://forum.arduino.cc/t/problem-with-include-wstring-h/48986/4 "2010-07-17T14:01:11Z")

</div>

worked great  
thanks

chilliman 🙂

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 8:19pm UTC](https://forum.arduino.cc/t/problem-with-include-wstring-h/48986/5 "2021-05-06T20:19:14Z")

</div>


