This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ iostream broken on windows 2000


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]