'CodeBlocks for Arduino: No such file or directory

My problem is basically this: I have installed CodeBlocks with the Arduino plugins and can compile and run the test program (blinking LED), now I am trying to write a test program that uses the ethernet module but I get the following error:

C:\Users\Dai\Documents\Projects\test\sketch.cpp|2|fatal error: Ethernet.h: No such file or directory|

The code looks like this:

#include <Arduino.h>
#include <Ethernet.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte ip[] {192,168,0,2};
byte gateway[] = {192,168,0,1};
byte subnet[] = {255,255,255,0};

Server server = Server(23);
void setup()
{
    pinMode(9, OUTPUT);
    Ethernet.begin(mac, ip, gateway, subnet);

    server.begin();
}

void loop()
{
    Client client = server.available();

    if(client == true) {
        //server.write(client.read());
        digitalWrite(9, HIGH);
    }
    else {
        digitalWrite(9, LOW);
    }
}

And all of the listed header files and their .cpp files appear to exist.

Can anybody see what I am doing wrong?



Solution 1:[1]

It is not a problem with your code, but with the configuration.

When the compiler sees the following line, it tries to include the library file.

#include <Ethernet.h>

And it is not able to include it. Check the Plugin to see where the library files should be placed and copy the library files to that directory and your problem should be solved.

Solution 2:[2]

Probably too late for an answer, but just for the record; Create a new project, right-click on the name -> add file recursively -> browse your way to the libraries folder and select it, click ok, then build and... off you go.

Solution 3:[3]

On Makefile, find the INCLUDE_LIBS variable and set the library you need, such as:

INCLUDE_LIBS=EEPROM;SD;LiquidCrystal;Ethernet;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sudar
Solution 2 Alan Cor
Solution 3 Kohlbrr