www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/02/14:53:43

Newsgroups: comp.os.msdos.djgpp
From: pjbk AT cee DOT hw DOT ac DOT uk (Peter JB King)
Subject: Re: C++ won't work!
Message-ID: <E07Br3.ECv@cee.hw.ac.uk>
Sender: news AT cee DOT hw DOT ac DOT uk (News Administrator)
Organization: Dept of Computing & Electrical Engineering, Heriot-Watt University, Scotland
References: <3274ED56 DOT 6761 AT dur DOT ac DOT uk> <32758D7D DOT 4EF28B3E AT alcyone DOT com>
Date: Fri, 1 Nov 1996 17:11:27 GMT
Lines: 32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <32758D7D DOT 4EF28B3E AT alcyone DOT com> Erik Max Francis <max AT alcyone DOT com> writes:
>Greeny wrote:
>
>> Whenever, I try and use GCC to compile C++ programs, it doesn't find the
>> libraries and compile correctly. eg. It will not recognise cout and
>> gives me an error. What am I doing wrong?
>
>This has to be by far and away the most common frequently-asked DJGPP
>question.
>
>The answer is that you're not linking in the appropriate C++ libraries.
>Put -liostream on the link line (before the -o argument) or use gxx instead
>of gcc.

I believe that the position of -liostream relative to the -o argument is
irrelevant, but that what is important is that -liostream comes AFTER 
all the files to be compiled or linked.

	gcc -o program -liostream program.cc funct.cc
will fail

	gcc -o program program.cc funct.cc  -liostream 
will succeed.

The -o argument can go anywhere on the line, so
	gcc program.cc funct.cc  -liostream -o program 
will succeed
-- 
Peter King, Computing & Electrical Eng.	 Internet: pjbk AT cee DOT hw DOT ac DOT uk
  Heriot-Watt University, Riccarton,      or  P DOT J DOT B DOT King AT heriot-watt DOT ac DOT uk
  Edinburgh EH14 4AS, Scotland
Phone: (+44) 131 451 3433               Fax: (+44) 131 451 3431

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019