| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Message-ID: | <004301c0780e$217ba340$73d363d8@aracnet.com> |
| From: | "Dave" <dave AT inkdrop DOT net> |
| To: | <cygwin AT sources DOT redhat DOT com> |
| Subject: | new Win98 install -- can't resolve std::cout |
| Date: | Sat, 6 Jan 2001 10:26:04 -0800 |
| MIME-Version: | 1.0 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Mailer: | Microsoft Outlook Express 5.50.4522.1200 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4522.1200 |
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 AT 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 AT inkdrop DOT net
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |