Your program is wrong at line 1;  #include is missing its filename.
cf. Stroustrup, The C++ Programming Language, pg 46, sec 3.2, Hello world 
program.

I have:
# uname -a
SunOS hank 5.11 snv_123 sun4u sparc sun4u
# /usr/sfw/bin/g++  --version | head -1
g++ (GCC) 3.4.3 (csl-sol210-3_4-20050802)

I get:
# g++ -O1 simple.cpp -o simple
simple.cpp:1:9: #include expects "FILENAME" or <FILENAME>
simple.cpp: In function `int main()':
simple.cpp:2: error: `cout' is not a member of `std'

Try hello.cpp:
#include <iostream>
int main() {std::cout << "Hello\n";}

Then I get:
# g++ -O1 hello.cpp -o hello
# ./hello
Hello, world!
# ldd -r hello
        libstdc++.so.6 =>        /usr/sfw/lib/libstdc++.so.6
        libm.so.2 =>     /lib/libm.so.2
        libgcc_s.so.1 =>         /usr/sfw/lib/libgcc_s.so.1
        libc.so.1 =>     /lib/libc.so.1
        /platform/sun4u/lib/libc_psr.so.1
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to