Click to See Complete Forum and Search --> : C header files in linux


Imin
12-09-2003, 08:29 AM
hi

if we've been using <iostream.h> in windows, do we use the same header file if we are to program in linux using gcc?

thanx a lot

tecknophreak
12-09-2003, 09:02 AM
You should be using <iostream> in both windows and linux. iostream.h will give you warnings in linux and i'm not sure, but i think it'll give you either warnings or errors in newer windows compilers. iostream.h will be taken out of gnu gcc in the future, so it's better to use iostream for current and future projects.

same with other headers like algorithm, fstream, vector, ctype, etc.

Citadel
12-09-2003, 01:03 PM
Originally posted by Imin
hi

if we've been using <iostream.h> in windows, do we use the same header file if we are to program in linux using gcc?

thanx a lot

Standard C++ uses a namespace called 'std' so all the libraries are organized into that logical group.

#include<iostream>

using std::cout;
using std::endl;

int main() {
cout << "Hello World" << endl;
return 0;
}

g++ prog.cpp
./a.out