delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/09/16/18:43:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Tue, 16 Sep 2003 18:43:25 EDT
To: cygwin AT cygwin DOT com
Subject: Re: g++ iostream broken on windows 2000
Message-Id: <VA.00000e68.00c54369@thesoftwaresource.com>
In-Reply-To: <bk618f$pic$1@sea.gmane.org>
References: <20030915234312 DOT 66294 DOT qmail AT web40708 DOT mail DOT yahoo DOT com> <bk618f$pic$1 AT sea DOT gmane DOT org>
From: Brian Keener <bkeenerReMoVeAnTiSpAm AT thesoftwaresource DOT com>
Reply-To: Brian Keener <bkeenerReMoVeAnTiSpAm AT thesoftwaresource DOT com>

Alex Vinokur wrote:
> > # include <iostream>
> > # include <fstream>
> 
> using namespace std;     // must be for g++ 3.x; otherwise you should use not 
'cout' but 'std::cout', etc.
> 
> >
>
Could someone tell me what I am doing wrong or do I have something set up wrong 
in my install.  I am simply trying to learn but if I put this in a file called 
first.cpp:

//
// this is first test application
//

#include <iostream>

using namespace std;

int main()
{
        cout << "Welcome to C++\r\n";
        cout << "Hope you learn a lot\r\n";

}

and then do:

/usr/develop/src/learning
$ gcc -g -o ./debug/first.exe ./first.cpp

I get this for output - not too pretty.

/tmp/ccRHUQ8U.o(.text+0x49): In function `main':
/usr/develop/src/learning/first.cpp:11: undefined reference to `std::cout'
/tmp/ccRHUQ8U.o(.text+0x56):/usr/develop/src/learning/first.cpp:11: undefined 
re
ference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< 
<
std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, 
cha
r const*)'
/tmp/ccRHUQ8U.o(.text+0x5d):/usr/develop/src/learning/first.cpp:12: undefined 
re
ference to `std::cout'
/tmp/ccRHUQ8U.o(.text+0x6a):/usr/develop/src/learning/first.cpp:12: undefined 
re
ference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< 
<
std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, 
cha
r const*)'
/tmp/ccRHUQ8U.o(.text+0x93): In function 
`_Z41__static_initialization_and_destru
ction_0ii':
/usr/include/c++/3.2/iostream:62: undefined reference to 
`std::ios_base::Init::I
nit[in-charge]()'
/tmp/ccRHUQ8U.o(.text+0xae):/usr/include/c++/3.2/iostream:62: undefined 
referenc
e to `std::ios_base::Init::~Init [in-charge]()'
/tmp/ccRHUQ8U.o(.eh_frame+0x11):first.cpp: undefined reference to 
`___gxx_person
ality_v0'
collect2: ld returned 1 exit status
/usr/develop/src/learning
$

And it doesn't get any better if I try it with -mno-cygwin.  I can compile the 
Cygwin cvs tree and the setup cvs tree but those you makefiles.

Any help or a pointer would be appreciated.

bk



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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