EthernetUdp2 does not name a type
The error you see, 'EthernetUdp2' does not name a type, means exactly that - there is no type EthernetUdp2 defined.

If you look at the source of EthernetUdp2.h, you'll see that the class declaration is EthernetUDP. See:

class EthernetUDP : public UDP {
    private:
        // Private members...
    public:
        EthernetUDP();  // Constructor

      // Public members...

};


class EthernetUDP : public UDP defines a class called EthernetUDP that inherets from the base class UDP. The constructor is what gets called when you instantiate a new object of type EthernetUDP.

Replace the line EthernetUdp2 udp; in your code with EthernetUDP udp; and it should work because the types will match. For reference:

#include &lt;Dhcp.h&gt;
#include &lt;Dns.h&gt;
#include &lt;Ethernet2.h&gt;
#include &lt;EthernetClient.h&gt;
#include &lt;EthernetServer.h&gt;
#include &lt;EthernetUdp2.h&gt;
#include &lt;Twitter.h&gt;
#include &lt;util.h&gt;


#include&lt;SPI.h&gt;


EthernetUDP udp; // &lt;---- This works

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}