I need to convert a .c file into .cpp file and I came across this declaration:
typedef void handler_t(int);
handler_t *Signal(int signum, handler_t *handler);
I included those two lines of code in the header file, and I add the actual function declaration function in the .cpp file.
handler_t *Signal(int signum, handler_t *handler){ ...... }
When I do this I get the error: "handler_t does not name a type".I have never worked before with typdef in C or C++, so can someone explain to me why I am getting an error?
My classes as requested:
#ifndef A_H
#define A_H
class A
{
public:
A();
virtual ~A();
typedef void handler_t(int);
handler_t* Signal(int signum, handler_t *handler);
protected:
private:
};
#endif // A_H
/////////////
#include "A.h"
A::A()
{
}
A::~A()
{
}
handler_t* A::Signal(int signum, handler_t *handler) {
...........
}
error:
|694|error: ‘handler_t’ does not name a type|