public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Gcc compiler b18 newbie probs
@ 1997-12-09 22:08 Rich Dorfman
  1997-12-10  7:40 ` Mumit Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Dorfman @ 1997-12-09 22:08 UTC (permalink / raw)
  To: gnu-win32

Just installed Gnu-Win32 b18 on Win95 P100 platform. Paths and environment
variables successfully added to autoexec.bat. 

Tried to compile the following:

#include <iostream.h>
int main(void)
{		
	cout << "Come up and C++ me some time."; 
	cout << "\n";
	return 0;
}

Got the following errors:

undefined reference to `cout'
undefined reference to `ostream::operator<<(char const *)'

I presume that iostream.h is not being found. The file resides at:
	C:\gnuwin32\b18\include\g++\iostream.h

I'm using the dos command line. I've tried the -I switch after my compile
statement. 	What is the proper switch?
	What is the proper syntax?
	Back slashes or forward slashes in the path?
	Should I be using BASH shell prompt? Advantages/disadvantages?

Thanks list for your help.


_____________________________________________________________

  \ | /   |==         Rich Dorfman
   \|/ eb |==         (414) 569-1228
          | eats      webhead@web-feats.com

  * Web page design, Internet marketing & instruction
  * Total connectivity solutions
  * Firewalls, content filtering & network security

          --->>  www.web-feats.com  <<---
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: Gcc compiler b18 newbie probs
  1997-12-09 22:08 Gcc compiler b18 newbie probs Rich Dorfman
@ 1997-12-10  7:40 ` Mumit Khan
  0 siblings, 0 replies; 6+ messages in thread
From: Mumit Khan @ 1997-12-10  7:40 UTC (permalink / raw)
  To: Rich Dorfman; +Cc: gnu-win32

Rule-of-thumb, especially for new users:
  
  - use the right compiler driver to compile/link programs. For C programs,
    use gcc, for C++ use c++ and for F77 use g77.

There are cases where you need a different driver, but then you'd have to
know what libraries need to be linked in explicitly and so on. Not worth
the hassle for usual projects, but sometimes needed for multi-language
projects, especially when mixing F77 and C/C++.

Regards,
Mumit -- khan@xraylith.wisc.edu
http://www.xraylith.wisc.edu/~khan/
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: Gcc compiler b18 newbie probs
@ 1997-12-11 19:03 dahms
  0 siblings, 0 replies; 6+ messages in thread
From: dahms @ 1997-12-11 19:03 UTC (permalink / raw)
  To: earnie_boyd; +Cc: gnu-win32, dahms

Hi Earnie, you wrote:

: It will compile it as C++ if you type
: 
: gcc -c hello.C

There is a third way besides the compiler name and filename case,
namely the -x option, to specify the language.


Bye, Heribert (dahms@ifk20.mach.uni-karlsruhe.de)
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: Gcc compiler b18 newbie probs
  1997-12-10 15:31 Earnie Boyd
@ 1997-12-11  2:23 ` Fergus Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Fergus Henderson @ 1997-12-11  2:23 UTC (permalink / raw)
  To: Cygnus GNU-win32 mailing list

Earnie Boyd <earnie_boyd@hotmail.com> wrote:
> 
> 
> >To: Rich Dorfman <webhead@web-feats.com>
> >Cc: gnu-win32@cygnus.com
> >Subject: Re: Gcc compiler b18 newbie probs
> >Date: Wed, 10 Dec 1997 09:40:38 -0600
> >From: Mumit Khan <khan@xraylith.wisc.edu>
> >
> >Rule-of-thumb, especially for new users:
> >  
> >  - use the right compiler driver to compile/link programs. For C 
> programs,
> >    use gcc, for C++ use c++ and for F77 use g77.
> 
>                           ^^^ shouldn't this be g++

Depends on what you want to link in.
`c++' just links in the standard C++ libraries, I think.
`g++' also links in libg++.

> gcc will (or so it is documented to do so) determine if the code is C++.  
> Also file extensions are used to determine C vs C++.  The cygwin gcc 
> will compile a file named hello.c as C if you type
> 
> gcc -c hello.c
> 
> It will compile it as C++ if you type
> 
> gcc -c hello.C

Yes, it will _compile_ it as C++, but if you do `gcc hello.C' it
will still _link_ it as if it were C (that is, it won't link in
the C++ libraries).

-- 
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: < http://www.cs.mu.oz.au/~fjh >   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: Gcc compiler b18 newbie probs
@ 1997-12-10 15:31 Earnie Boyd
  1997-12-11  2:23 ` Fergus Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Earnie Boyd @ 1997-12-10 15:31 UTC (permalink / raw)
  To: khan; +Cc: gnu-win32

>To: Rich Dorfman <webhead@web-feats.com>
>Cc: gnu-win32@cygnus.com
>Subject: Re: Gcc compiler b18 newbie probs
>Date: Wed, 10 Dec 1997 09:40:38 -0600
>From: Mumit Khan <khan@xraylith.wisc.edu>
>
>Rule-of-thumb, especially for new users:
>  
>  - use the right compiler driver to compile/link programs. For C 
programs,
>    use gcc, for C++ use c++ and for F77 use g77.

                          ^^^ shouldn't this be g++

gcc will (or so it is documented to do so) determine if the code is C++.  
Also file extensions are used to determine C vs C++.  The cygwin gcc 
will compile a file named hello.c as C if you type

gcc -c hello.c

It will compile it as C++ if you type

gcc -c hello.C

hello.c and hello.C are the same file as the win32 filesystem is case 
insensitive when in comes to finding the file on disk.  However the 
command line case is kept intact so that gcc will operate differently on 
the file based on the lowercase .c or the UPPERCASE .C.


>
>There are cases where you need a different driver, but then you'd have 
to
>know what libraries need to be linked in explicitly and so on. Not 
worth
>the hassle for usual projects, but sometimes needed for multi-language
>projects, especially when mixing F77 and C/C++.
>
>Regards,
>Mumit -- khan@xraylith.wisc.edu
> http://www.xraylith.wisc.edu/~khan/
>-
>For help on using this list (especially unsubscribing), send a message 
to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>


-        \\||//
---o0O0--Earnie--0O0o----
-earnie_boyd@hotmail.com-
------ooo0O--O0ooo-------


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

* Re: Gcc compiler b18 newbie probs
@ 1997-12-09 23:12 Colin Peters
  0 siblings, 0 replies; 6+ messages in thread
From: Colin Peters @ 1997-12-09 23:12 UTC (permalink / raw)
  To: Rich Dorfman; +Cc: GNU-Win32

From: Rich Dorfman <webhead@web-feats.com>
To: gnu-win32@cygnus.com <gnu-win32@cygnus.com>
Date: Wednesday, December 10, 1997 3:43 PM


>Just installed Gnu-Win32 b18 on Win95 P100 platform. Paths and
environment
>variables successfully added to autoexec.bat.
>
>Tried to compile the following:
>
>#include <iostream.h>
>int main(void)
>{ 
> cout << "Come up and C++ me some time."; 
> cout << "\n";
> return 0;
>}
>
>Got the following errors:
>
>undefined reference to `cout'
>undefined reference to `ostream::operator<<(char const *)'
>
>I presume that iostream.h is not being found. The file resides at:
> C:\gnuwin32\b18\include\g++\iostream.h

The problem is not iostream.h not being found. Note that the linker (not the compiler) is complaining, and it knows about ostream, which it wouldn't if it wasn't reading the headers. The problem is that the iostream library is not being linked. Try adding -lstdc++ on your link line (or using g++ instead of gcc to do your linking).

Good luck,
Colin.

-- Colin Peters -- colin at fu.is.saga-u.ac.jp
-- Saga University Dept. of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin
-- http://www.geocities.com/Tokyo/Towers/6162



-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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

end of thread, other threads:[~1997-12-11 19:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-09 22:08 Gcc compiler b18 newbie probs Rich Dorfman
1997-12-10  7:40 ` Mumit Khan
1997-12-09 23:12 Colin Peters
1997-12-10 15:31 Earnie Boyd
1997-12-11  2:23 ` Fergus Henderson
1997-12-11 19:03 dahms

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).