head file for the use of 'error'

In the c++ codes, I would like to use
error("Something I would like to say");
what is the headfile I need to use if I want 'error'?
Thank you!
I don't know any standard error() function. Use fprintf(stderr, "%s\n", "Something I would like to say"); instead.

Therefore include <stdio.h>

A more C++ like method would be:

1
2
3
4
5
6
7
#include <iostream>

// ...

std::clog << "Something I would like to say" << std::endl;

// ... 
Thanks, i'm thinking to use the following instead
cout<<"something";
std::cout is for output.
std::clog is for logging.
std::cerr is for errors.
Thanks a lot!

ps: i have put #include <iosstream> in the .h, why do you still use
std::cout instead of cout? Any difference?
Generally, no. Some people (such as myself) prefer to have std::cout rather than using using namespace std;. The main reason for this is so that you can name functions and variables whatever you like, without accidentally giving it the same name as one already defined by the standard library.
Topic archived. No new replies allowed.