Error creating library: 'SoftwareSerial' does not name a type

hi there everybody
i’m new to the Arduino world and I think i am missing some basical stuff to make things working well…
I used to code a lot in c/c++,java etc, now in Arduino I have some problems with the language and the coding standards…

I am trying to write a simple library for an Arduino UNO using Arduino IDE 1.0.1 on windows 7 x64.

I wrote these files:

serial2.h

#ifndef serial2_h
#define serial2_h
#include <Arduino.h>
 
class serial2
{
 public:
     serial2();
 private:
};

#endif

serial2.cpp

#include "Arduino.h"
#include "serial2.h"
#include <SoftwareSerial.h>

SoftwareSerial Serial_2(2, 3);

serial2::serial2(){
  
}

Uno.ino

#include <serial2.h>

void setup(){
}

void loop(){
}

but I am getting this error:

serial2.cpp:4: error: 'SoftwareSerial' does not name a type

I used SoftwareSerial in another skech and it worked well, but i cannot figure out why in this library is not recognized.
Am I writing the library in a wrong way?
Thanks everybody

You are trying to hide the use of a library from the sketch. You can not do that. You must do what everyone else does, and tell the sketch that you are using SoftwareSerial, but #including it's header file.

thanks for the reply, so i have to specifically include the library also in the main file?
I modified the files in this way, but i’m still getting the same error

serial2.h

#ifndef serial2_h
#define serial2_h
#include <Arduino.h>


class serial2
{
 public:
     serial2();
 private:
      SoftwareSerial Serial_2(2, 3);
};

#endif

serial2.cpp

#include "Arduino.h"
#include "serial2.h"


serial2::serial2(){
}

Uno.ino

#include <serial2.h>

#include <SoftwareSerial.h>

void setup(){
}

void loop(){
}

Your header file references the SoftwareSerial class. You need to #include SoftwareSerial.h in your header file, not in your source file.

Then. you will have other errors. The private member Serial_2 is defined AND INITIALIZED in the header. That is not allowed. You need to define it, only:

      SoftwareSerial Serial_2;

Then, in the source file, you need to initialize it:

serial2::serial2():Serial_2(2,3)

Can someone elaborate where can we get the header files.
I am trying to use the SoftwareSerial but it is not recognizing it as datatype or keyword

Can someone elaborate where can we get the header files.

They come with all the recent (1.0+) versions of the IDE. What version are you using with what board?