help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: glibc-2.7 and gcc-4.2.2 install on redhat 3 u 9 - x86_64


From: FÖLDY Lajos
Subject: RE: glibc-2.7 and gcc-4.2.2 install on redhat 3 u 9 - x86_64
Date: Tue, 15 Apr 2008 19:39:45 +0200


On Tue, 15 Apr 2008, Lamont, Brian-p3354c wrote:


Lajos,
i changed to <iostream>, and it gave the same error.

# gcc hello.c
hello.c:1:22: error: iostream.h: No such file or directory
hello.c:2: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before 
ânames paceâ
hello.c: In function âmainâ:
hello.c:3: error: âcoutâ undeclared (first use in this function)
hello.c:3: error: (Each undeclared identifier is reported only once
hello.c:3: error: for each function it appears in.)


i then used "g++" instead, and it gave a different error.

g++ hello.c
hello.c:1:20: error: iostream: No such file or directory
hello.c: In function âint main()â:
hello.c:3: error: âcoutâ was not declared in this scope


this happens using g++ with both iostream and iostream.h.  iostream is located 
below.

# find / -name iostream.h
/usr/include/c++/3.2.3/backward/iostream.h
/usr/include/g++-3/iostream.h
/lib64/ssa/gcc-lib/x86_64-redhat-linux-gnu/3.5-tree-ssa/include/c++/backward/iostream.h
find: . changed during execution of find



which g++
/usr/bin/g++

which gcc
/usr/bin/gcc


if the problem is not finding iostream, how do i get the program to know where 
it is?   And do i need glibc installed?   I'm also reading blurbs that glibc 
cannot be installed on a live system.


-----Original Message-----
From: help-gplusplus-bounces+brian.lamont=gdc4s.com@gnu.org 
[mailto:help-gplusplus-bounces+brian.lamont=gdc4s.com@gnu.org] On Behalf Of 
FÖLDY Lajos
Sent: Monday, April 14, 2008 11:31 PM
To: help-gplusplus@gnu.org
Subject: Re: glibc-2.7 and gcc-4.2.2 install on redhat 3 u 9 - x86_64



On Mon, 14 Apr 2008, Lamont, Brian-p3354c wrote:

Hello,
I'm trying to install gcc-4.2.2, and It appeared to install ok, but cannot compile the 
hello program below.  I'm not very skilled at troubleshooting these installs, so forgive 
me if something is obvious.  The C Program error below was thought by a developer in my 
area to be possibly missing glibc.   So I began installing glibc.  It errors (below) 
because the linker does not support a -z option for "relro".   I have 
binutils-2.15 installed.  Let me know of any other helpful info I can provide.

OS: Redhat Ent. Linux 3 updt 9
kernel: 2.4.21-50

#  gcc hello.c
hello.c:1:22: error: iostream.h: No such file or directory
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Use <iostream>.

regards,
lajos



hello.c:2: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â
before ânamespaceâ
hello.c: In function âmainâ:
hello.c:3: error: âcoutâ undeclared (first use in this function)
hello.c:3: error: (Each undeclared identifier is reported only once
hello.c:3: error: for each function it appears in.)


c program to test gcc-4.2.2
---------------------------
# cat hello.c

#include <iostream.h>
using namespace std;
int main () { cout << "hello world\n"; return 0;}



glibc configure output - version 2.7
-------------------------------------
cd ../glibc-build
# ../glibc-2.7/configure
checking build system type... x86_64-unknown-linux-gnu checking host
system type... x86_64-unknown-linux-gnu
configure: running configure fragment for add-on nptl checking sysdep
dirs... sysdeps/x86_64/elf nptl/sysdeps/unix/sysv/linux/x86_64
sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/wordsize-64
nptl/sysdeps/unix/sysv/linux nptl/sysdeps/pthread sysdeps/pthread
sysdeps/unix/sysv/linux sysdeps/gnu sysdeps/unix/common
sysdeps/unix/mman sysdeps/unix/inet nptl/sysdeps/unix/sysv
sysdeps/unix/sysv sysdeps/unix/x86_64 nptl/sysdeps/unix sysdeps/unix
sysdeps/posix sysdeps/x86_64/fpu nptl/sysdeps/x86_64 sysdeps/x86_64
sysdeps/wordsize-64 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64
sysdeps/ieee754/flt-32 sysdeps/ieee754 sysdeps/generic/elf
sysdeps/generic checking for a BSD-compatible install...
/usr/bin/install -c checking whether ln -s works... yes checking for
gcc... gcc checking for suffix of object files... o checking whether
autoconf works... no
configure: WARNING:
*** These auxiliary programs are missing or incompatible versions:
autoconf
*** some features will be disabled.
*** Check the INSTALL file for required versions.
checking whether ranlib is necessary... yes checking LD_LIBRARY_PATH
variable... ok checking whether GCC supports -static-libgcc...
-static-libgcc checking for assembler .type directive prefix... @
checking for .symver assembler directive... yes checking for ld
--version-script... yes checking for libunwind-support in compiler...
no checking for -z nodelete option... yes checking for -z nodlopen
option... yes checking for -z initfirst option... yes checking for -z
relro option... no
configure: error: linker with -z relro support required






Thank you,
Brian Lamont
CSC - Muos Ran unix support
Cell: 480 209-8751
Desk: 480 441-4436
This email message is for the sole use of the intended recipient(s) and may 
contain GDC4S confidential or privileged.  information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not an 
intended recipient, please contact the sender by reply email and destroy all 
copies of the original message NOTE: Regardless of content, this e-mail shall 
not operate to bind CSC to any order or other contract unless pursuant to 
explicit written agreement or government initiative expressly permitting the 
use of e-mail for such purpose.











<iostream> is the standard header, GCC changed from <iostream.h> to <iostream> long ago (<iostream.h> was kept under "backward" for a while).

Also, always use g++ (the GCC C++ compiler) to compile C++ programs. If you have different versions of GCC installed, be sure that you are using the version you wanted (check g++ -v output).

(Your hello.c is a C++ program, so rename it to hello.cc or hello.cpp.
It is better to use .c for real C programs only.)

regards,
lajos

reply via email to

[Prev in Thread] Current Thread [Next in Thread]