Click to See Complete Forum and Search --> : some information about c++


deathadder
02-10-2003, 07:00 PM
ive been teachin myself c++ in windows now for a while and im gettin the basics i was wounderin if c++ is:

a) like i heard different for windows and linux, i mean differences in the code

b)if it is different how different, could i get away with usin the windows verson of would i need to learn it for linux

thanks

Palin
02-10-2003, 07:09 PM
the standard C++ functionality is the same the librarieas and headers you use may be different. if you use g++ you can use the old standard way of including the standard libraries or you can use the new ones
old <iostream.h>

new <iostream>

g++ is built to the ANSI standard so if you know that you should be ok. Hope this helps

deathadder
02-10-2003, 07:24 PM
yeah it does help thanks for the reply

Dun'kalis
02-10-2003, 07:37 PM
You'll also have to do one of the following for any header functions you use, if you're using the new headers.

Here is the example program I'll use
#include <iostream>

int main()
{
cout << "Hello, world!";
}

This prints "Hello, world!".

If you compile it, it will complain. To fix that..

A. Instead of cout, use std::cout
B. Put the line "using std::cout;" before the main.
C. Put the line "using namespace std;" before the main.

Use any of these.

Word of Warning:
"using namespace std;" is NOT recommended! Use A or B, preferably.