This is the mail archive of the cygwin@sources.redhat.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]

new Win98 install -- can't resolve std::cout


I apologize for such a basic question. I've installed binaries for gcc ports to
Windows several times in past few years and I've always had the whole
system come up easily.

Yesterday I used the new setup.exe program to install all the packages on
a Windows98 system. Installation went fine, bash came up quite happy.
I tried a "hello world" program called test.cpp, which looks like this:

>tango@TETONS /cygdrive/n/randy/qprofile
>$ cat test.cpp
>
>#include <iostream>
>
>int main()
>{
>        std::cout << "Hello world!" << std::endl;
>}

Then I ran the command "gcc -ansi -v test.cpp" and got link errors. The screen
dump looks like this (forgive the screen wrapping -- I copied-n-pasted this
from the bash window):

$ gcc -ansi -v test.cpp
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/specs
gcc version 2.95.2-6 19991024 (cygwin experimental)
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/cpp.exe -lang-c++ -v -D__GNUC__=2 -D__
GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -trigraphs -D__STRICT_ANSI__ -D__i386
__ -D__386__ -D__i386 -D_X86=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall
__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D_
_i386 -Asystem(winnt) -Acpu(i386) -Amachine(i386) -D__EXCEPTIONS -remap -Acpu(i3
86) -Amachine(i386) -D__i386 -D__i386__ -D__i686 -D__i686__ -D__pentiumpro -D__p
entiumpro__ -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -isystem /usr
/local/include -idirafter /usr/include -D_WIN32 -DWINNT -idirafter /usr/include/
w32api test.cpp /tmp/ccYBljCb.ii
GNU CPP version 2.95.2-6 19991024 (cygwin experimental) (80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/../../../../include/g++-3
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/include
 /usr/include
 /usr/include/w32api
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/cc1plus.exe /tmp/ccYBljCb.ii -quiet -d
umpbase test.cc -ansi -version -o /tmp/cccfMQGq.s
GNU C++ version 2.95.2-6 19991024 (cygwin experimental) (i686-pc-cygwin) compile
d by GNU C version 2.95.2-6 19991024 (cygwin experimental).
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/../../../../i686-pc-cygwin/bin/as.exe
-o /tmp/ccWaw71e.o /tmp/cccfMQGq.s
 /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6/collect2.exe -Bdynamic /usr/lib/crt0.o
 -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2-6 -L/usr/lib/mingw /tmp/ccWaw71e.o -lg
cc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc
/tmp/ccWaw71e.o(.text+0x1f):test.cpp: undefined reference to `endl(ostream &)'
/tmp/ccWaw71e.o(.text+0x2c):test.cpp: undefined reference to `cout'
/tmp/ccWaw71e.o(.text+0x31):test.cpp: undefined reference to `ostream::operator<
<(char const *)'
collect2: ld returned 1 exit status

So, what went wrong? It looks like all the likely libraries were specified in the
link phase. It doesn't matter if I use the -ansi switch or not. It also doesn't matter
if I include <iostream.h> and use cout in the global namespace. Same link error.

A C++ "hello world" program that uses <stdio.h> and printf() links correctly.
It links against the identical set of libraries.

Suggestions?

Thanks!

     -- Dave
     -- dave@inkdrop.net



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


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