public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem In compiling C++ codes
@ 2001-02-22  9:37 aaboulhosn
  2001-02-22 10:36 ` sherry
  0 siblings, 1 reply; 9+ messages in thread
From: aaboulhosn @ 2001-02-22  9:37 UTC (permalink / raw)
  To: Help-gcc

Hello

  May name is : AREF ABOULHOSN

  I have a problem compiling my C++ code, I will appreciate it if you can
help me solve this problem.

  I installed , gcc 2.9.5.2   package on  SOL  7 ,  Intel.
  I was able to compile   C code   , and run the program   (NO PROBLEMS)

   when, I try  to compile my C++ code , I get  an ERROR Message, Cannot
fin   : iostream.h    (file)
   and the file is there in the include dirctory.

  If , you can give me some help , I appreciate it.

My E-mail is   :
aaboulhosn@entpm2.prod.fedex.com

Thanks
AREF

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
  2001-02-22  9:37 Problem In compiling C++ codes aaboulhosn
@ 2001-02-22 10:36 ` sherry
  0 siblings, 0 replies; 9+ messages in thread
From: sherry @ 2001-02-22 10:36 UTC (permalink / raw)
  To: aaboulhosn; +Cc: Help-gcc

Hello Aref

you prbably know this but incase it skipped your mind,
make sure your include files are in your path.


aaboulhosn@entpm2.prod.fedex.com wrote:

> Hello
>
>   May name is : AREF ABOULHOSN
>
>   I have a problem compiling my C++ code, I will appreciate it if you can
> help me solve this problem.
>
>   I installed , gcc 2.9.5.2   package on  SOL  7 ,  Intel.
>   I was able to compile   C code   , and run the program   (NO PROBLEMS)
>
>    when, I try  to compile my C++ code , I get  an ERROR Message, Cannot
> fin   : iostream.h    (file)
>    and the file is there in the include dirctory.
>
>   If , you can give me some help , I appreciate it.
>
> My E-mail is   :
> aaboulhosn@entpm2.prod.fedex.com
>
> Thanks
> AREF

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
  2001-02-23 10:13 aaboulhosn
  2001-02-23 10:43 ` sherry
@ 2001-02-23 17:43 ` llewelly_nospam_
  1 sibling, 0 replies; 9+ messages in thread
From: llewelly_nospam_ @ 2001-02-23 17:43 UTC (permalink / raw)
  To: aaboulhosn; +Cc: help-gcc

[snip]
> libstdc++.so.2.10.0   exist under    this directory:
> /usr/local/lib
[snip]

Under most unices, you need to have the directories containing your
  shared libs in the LD_LIBRARY_PATH variable.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
  2001-02-22 10:56 ` sherry
  2001-02-22 12:18   ` David T-G
@ 2001-02-23 17:33   ` llewelly_nospam_
  1 sibling, 0 replies; 9+ messages in thread
From: llewelly_nospam_ @ 2001-02-23 17:33 UTC (permalink / raw)
  To: sherry; +Cc: aaboulhosn, gcc-help

[snip]
> 
> man g++ will help you :)

The man pages are no longer maintained.
Use:
  info g++

[snip]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
  2001-02-23 10:13 aaboulhosn
@ 2001-02-23 10:43 ` sherry
  2001-02-23 17:43 ` llewelly_nospam_
  1 sibling, 0 replies; 9+ messages in thread
From: sherry @ 2001-02-23 10:43 UTC (permalink / raw)
  To: aaboulhosn, help-gcc

aaboulhosn@entpm2.prod.fedex.com wrote:

> But , when, I compile in C++   ,   no errors,   But, when I  type:    a.out
> or   ./a.out
> It give me  this Error:
> ld.so.1 :  a.out:  fatal:  libstdc++.so.2.10.0: open failed: No such file
> or directory
>

ld is gnu linker.
man ld will give you a lot of information about what it is and how it works.

So , to me it seems like you linked your executable with dynamic library,
and the linker can not find your library at run time.
(I hope David correct s me, if I am wrong again)
Now the linker does not use PATH to find the dynamic libraries on your system
but you can specify the path using -L option when linking (ld man pages again)

You can also link your program staticly , you should also know the difference
between
static and dynamic linking and advantages and disadvantages of each. (g++ man
pages for static linking)
(depending on you requirements one may be better than the other ......)

There is also the -rpath option that can be set when linking to help the
linker to find the
runtime libraries (check out man ld)
Did you read g++ man pages ? ... you must read it carefully

Another handy command to know is ldd , try
ldd ./a.out
to see what libraries are linked to your executable. (do not forget man ldd
;) )

>
> I checked my PATH:
> PATH=/usr/bin:/usr/local/:/usr/local/lib
>
> libstdc++.so.2.10.0   exist under    this directory:
> /usr/local/lib
>
> I tired to copy : libstdc++.so.2.10.0  to the directory where  a.out is  ,
> (as a test)it does not help

This won't help ;)

>
> Thank you
> I appreciate it if you , continue working with me until I resolve this
> problem
>
> AREF

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
@ 2001-02-23 10:13 aaboulhosn
  2001-02-23 10:43 ` sherry
  2001-02-23 17:43 ` llewelly_nospam_
  0 siblings, 2 replies; 9+ messages in thread
From: aaboulhosn @ 2001-02-23 10:13 UTC (permalink / raw)
  To: help-gcc

---------------------- Forwarded by AREF ABOULHOSN/F47621C/VEND/FEDEX on
02/23/2001 01:13 PM ---------------------------


AREF ABOULHOSN
02/23/2001 08:55 AM

To:   David T-G <davidtg@bigfoot.com>
cc:

Subject:  Re: Problem In compiling C++ codes  (Document link: AREF
      ABOULHOSN)

Hello Sherry and David

I tried all the procedures you gave me, Thank you very much  for your help
( But I still having some problem)
That's where I am now.
The problem is:
 when I Type :   a.out       or         ./a.out

 It works for   C  and runs the program

But , when, I compile in C++   ,   no errors,   But, when I  type:    a.out
or   ./a.out
It give me  this Error:
ld.so.1 :  a.out:  fatal:  libstdc++.so.2.10.0: open failed: No such file
or directory

I checked my PATH:
PATH=/usr/bin:/usr/local/:/usr/local/lib

libstdc++.so.2.10.0   exist under    this directory:
/usr/local/lib

I tired to copy : libstdc++.so.2.10.0  to the directory where  a.out is  ,
(as a test)it does not help
Thank you
I appreciate it if you , continue working with me until I resolve this
problem

AREF



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
@ 2001-02-23 10:12 aaboulhosn
  0 siblings, 0 replies; 9+ messages in thread
From: aaboulhosn @ 2001-02-23 10:12 UTC (permalink / raw)
  To: help-gcc

---------------------- Forwarded by AREF ABOULHOSN/F47621C/VEND/FEDEX on
02/23/2001 01:11 PM ---------------------------


AREF ABOULHOSN
02/23/2001 01:10 PM

To:   help-gcc@gnu.org
cc:

Subject:  Re: Problem In compiling C++ codes


---------------------- Forwarded by AREF ABOULHOSN/F47621C/VEND/FEDEX on
02/23/2001 01:10 PM ---------------------------


AREF ABOULHOSN
02/22/2001 01:49 PM

To:   sherry <sherry@zeroknowledge.com>
cc:

Subject:  Re: Problem In compiling C++ codes  (Document link: AREF
      ABOULHOSN)

I appreciate your response.

  1)   I  Tried to put  the whole path in my C++ program like this:
        #include   <path directory for my header file/iostream.h>

   and tried to compile, it does not work.
  is there any other way, to include the path  name ?

 2)  If I have  an : a.out     execuatble file
       when I type:  a.out     It does not find the link library


 3)  what is the extension for the source file , in C++ and how to compile
it ?


       I know  for my C program, example:

filename.c
To compile :    gcc    filename.c

Thank you








^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
  2001-02-22 10:56 ` sherry
@ 2001-02-22 12:18   ` David T-G
  2001-02-23 17:33   ` llewelly_nospam_
  1 sibling, 0 replies; 9+ messages in thread
From: David T-G @ 2001-02-22 12:18 UTC (permalink / raw)
  To: gcc-help; +Cc: sherry, aaboulhosn

Aref, et al --

It appears that you replied only to Sherry after she replied to you, so
I'm stepping into the discussion late...


...and then sherry said...
% aaboulhosn@entpm2.prod.fedex.com wrote:
% 
% > I appreciate your response.
% >
% >   1)   I  Tried to put  the whole path in my C++ program like this:
% >         #include   <path directory for my header file/iostream.h>
% >
% >    and tried to compile, it does not work.
% >   is there any other way, to include the path  name ?
% 
% Check the PATH environment variable:
%     echo $PATH should give you that , you can modify it also.

Actually, the shell's $PATH variable doesn't have to do with your
code's #include directives.  In the case above, you should leave off 
the <> and just specify something like

  #include /path/to/headers/iostream.h

(whereas using <iostream.h> will pick up the *system's* copy of the
header file).


% >
% >  2)  If I have  an : a.out     execuatble file
% >        when I type:  a.out     It does not find the link library
% 
% this problem can be related to the path also.

Yep; you probably don't have (and shouldn't have!) '.', or the current
directory, in your path.  Instead of typing

  a.out

to run your program, simply type

  ./a.out

to tell the shell to look in the current directory.


% 
% >
% >
% >  3)  what is the extension for the source file , in C++ and how to compile
% > it ?
% 
% man g++ will help you :)

That's probably the best answer :-)


% 
% >
% >
% >        I know  for my C program, example:
% >
% > filename.c
% > To compile :    gcc    filename.c
% >
% > Thank you
% 
% welcome

HTH & HAND


:-D
-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE6lXP8UScpmrZtnuoRAiHCAJ9H9GvFkWeCw8fp5PIPaK+iQ637BQCeMSLY
oukpqRoo3MNklT4NRgdjrA4=
=GpCO
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problem In compiling C++ codes
       [not found] <OFD8570FFF.DDD367A3-ON862569FB.0066800D@prod.fedex.com>
@ 2001-02-22 10:56 ` sherry
  2001-02-22 12:18   ` David T-G
  2001-02-23 17:33   ` llewelly_nospam_
  0 siblings, 2 replies; 9+ messages in thread
From: sherry @ 2001-02-22 10:56 UTC (permalink / raw)
  To: aaboulhosn, gcc-help

aaboulhosn@entpm2.prod.fedex.com wrote:

> I appreciate your response.
>
>   1)   I  Tried to put  the whole path in my C++ program like this:
>         #include   <path directory for my header file/iostream.h>
>
>    and tried to compile, it does not work.
>   is there any other way, to include the path  name ?

Check the PATH environment variable:
    echo $PATH should give you that , you can modify it also.
If you are using bash like me and type env at console then you can
see all variables and path is there.
else check the man pages for your shell

>
>
>  2)  If I have  an : a.out     execuatble file
>        when I type:  a.out     It does not find the link library

this problem can be related to the path also.

>
>
>  3)  what is the extension for the source file , in C++ and how to compile
> it ?

man g++ will help you :)

>
>
>        I know  for my C program, example:
>
> filename.c
> To compile :    gcc    filename.c
>
> Thank you

welcome

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-02-23 17:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-22  9:37 Problem In compiling C++ codes aaboulhosn
2001-02-22 10:36 ` sherry
     [not found] <OFD8570FFF.DDD367A3-ON862569FB.0066800D@prod.fedex.com>
2001-02-22 10:56 ` sherry
2001-02-22 12:18   ` David T-G
2001-02-23 17:33   ` llewelly_nospam_
2001-02-23 10:12 aaboulhosn
2001-02-23 10:13 aaboulhosn
2001-02-23 10:43 ` sherry
2001-02-23 17:43 ` llewelly_nospam_

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).