Errorss.....

Hey im getting a couple of compile errors in this thing im trying to compile could someone help me out? (p.s. I have no clue what it does i found it in a book)

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using namespace std;

namespace Stack {
    void push(char);
    char pop();
}

void f()
{
    Stack::push('c');
    if(Stack::pop() != 'c') error("impossible");
}



In function `void f()'
12 `error' undeclared (first use this function) 
You can't have copied it right; that code makes no sense. If you've copied it right, the book is wrong.
Your compiler error is telling you that it doesn't know what the function error() is.
Like chrisname said, the code makes no sense. Maybe you're leaving something out?
Did you copy it from Stroustrup's book, modular programming paragraph? It won't compile, those examples aren't meant to compile. He just uses them to demonstrate different programming styles.
Topic archived. No new replies allowed.