View Single Post

   
  #2 (permalink)  
Old 01-04-2008, 09:03 PM
Dan Foster
 
Posts: n/a
Default Re: Need help with UNIX compiler commands

In article <xd37b.186$NW3.175@news1.central.cox.net>, Les Coover <lcc66604@cox.net.spam> wrote:
> Consider this simple C++ program:
>
> #include <iostream.h>
> int main(void) {
>
> cout << "Hello, world!" << endl;
> return 0; //This is optional
> }
>
> I can't get the UNIX compiler to recognize <iostream.h>


1. The C++ standard now uses #include <iostream> rather than the .h form.

It will still work for backward compatibility for at least a while or
indefinitely but you should be using the modern form for anything new.

2. You're trying to use the C compiler to compile a C++ program. You want
to use the C++ compiler instead.

3. The file is test.c or whatever -- you may want to rename it to test.C

4. Then do:

$ xlC test.C -o <outputfilename>

That will work without any errors.

-Dan
Reply With Quote