Hi,

Thank you for helping.

My source:

#include <iostream>
#include <cstdlib>
#include <exception>

using namespace std;

void MyQuit();
void mamama() throw(char *);
set_terminate(MyQuit);
int main()
{
    mamama();
    return 0;
}
void MyQuit()
{
    cout<<"Uncaugh specification!\n";
}
void mamama()throw(char *)
{
    throw "this is end!\n";
    exit(5);
}

And I get error msg:
error: expected constructor,destructor, or type conversion before '(' token
I am doing according c++primer book an example but I don't know I do get the problem, please help me. thank you

**please use code tags in the future**

The line "set_terminate(MyQuit);" should have been put inside the main() function. Just move it into main() and it will work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.