G++ compiling with -mno-cygwin and mingw libraries doesn't link
Bruce Rosen
rosen@oingo.com
Tue Aug 8 18:34:00 GMT 2000
I solved my problem of memory allocation beyond 128 meg of memory by using
the -mno-cygwin G++ flag. So the program below compiles and executes
properly with
g++ -mno-cygwin a.cpp
#include <string.h>
int sleep(int a);
int main()
{
char *p;
#define SIZE 450000000
p = new char[SIZE];
memset(p, 0, SIZE);
}
However, when I augment it with C++ cout statements (below), I cannot get it
to
link. I get errors to undefined references. I downloaded the mingw libraries
and include files
and while this helps, I still get link errors.
#include <stdlib.h>
#include <iostream>
#include <string.h>
int main()
{
char *p ;
#define SIZE 450000000
p = new char[SIZE];
memset(p, 0, SIZE );
cout << p[244] << endl;
}
Any help would be appreciated.
Bruce
g++ -mno-cygwin -I/usr/local/mingw/include test.cpp -L/usr/local/mingw/lib
>& err
/usr/local/mingw/lib/libstdc++.a(iostream.o)(.text+0x2990): multiple
definition
of `ostream::operator<<(ostream &(*)(ostream &))'
/tmp/ccfOFFUm.o(.text$__ls__7ostreamPFR7ostream_R7ostream+0x0):test.cpp:
first d
efined here
/usr/local/mingw/lib/libstdc++.a(iostream.o)(.text+0x1d70): multiple
definition
of `_IO_ostream_withassign type_info function'
/tmp/ccfOFFUm.o(.text$__tf22_IO_ostream_withassign+0x0):test.cpp: first
defined
here
/usr/local/mingw/lib/libstdc++.a(iostream.o)(.text+0x1eac): multiple
definition
of `_IO_istream_withassign type_info function'
/tmp/ccfOFFUm.o(.text$__tf22_IO_istream_withassign+0x0):test.cpp: first
defined
here
/usr/local/mingw/lib/libstdc++.a(iostream.o)(.text+0x22f4): multiple
definition
of `iostream type_info function'
/tmp/ccfOFFUm.o(.text$__tf8iostream+0x0):test.cpp: first defined here
/usr/local/mingw/lib/libstdc++.a(iostream.o)(.text+0x28ac): multiple
definition
of `istream type_info function'
/tmp/ccfOFFUm.o(.text$__tf7istream+0x0):test.cpp: first defined here
I 'm running cygwin on a WINNT PIII machine with 785 meg of memory
here are the G++ parameters:
/bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2/cpp.exe -lang-c -v -iprefix
/bin/../l
ib/gcc-lib/i686-pc-cygwin/2.95.2/ -D__GNUC__=2 -D__GNUC_MINOR__=95 -Di386 -D
_X86
=1 -D__STDC__=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribu
te__
((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__i386__ -D_X86=1 -D__STD
C__=
1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl_
_))
-D__declspec(x)=__attribute__((x)) -D__i386 -Asystem(winnt) -Acpu(i386) -Ama
chin
e(i386) -remap -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686
-Dp
entiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ -D__CYGWIN32__
-D_
_CYGWIN__ -Dunix -D_WIN32 -DWINNT --help help-dummy /tmp/ccgw0dun.i
GNU CPP version 2.95.2 19991024 (release-2) (80386, BSD syntax)
/bin/../lib/gcc-lib/i686-pc-cygwin/2.95.2/collect2.exe -Bdynamic --help
/usr/li
b/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-pc-cygwin/lib/crt0.o -L/bin
/../
lib/gcc-lib/i686-pc-cygwin/2.95.2 -L/bin/../lib/gcc-lib -L/usr/lib/gcc-lib/i
686-
pc-cygwin/2.95.2 -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../i686-p
c-cy
gwin/lib
/tmp/ccCJG2dS.o -lstdc++ -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32
-lshell32 -lgcc
Any help would be appreciated.
thanks
bruce
Here is the cygcheck output:
cygcheck
Cygnus Win95/NT Configuration Diagnostics
Current System Time: Mon Aug 07 12:19:10 2000
WinNT Ver 4.0 build 1381 Service Pack 4
Path:
.
/usr/local/bin
/bin
/WINNT/system32
/WINNT
/Program Files/Mt
SysDir: C:\WINNT\System32
WinDir: C:\WINNT
HOME = `/WINNT/Profiles/rosen/Desktop'
MAKE_MODE = `unix'
PWD = `/WINNT/Profiles/rosen/Desktop/cyg'
USER = `administrator'
Use `-r' to scan registry
a: fd N/A N/A
c: hd NTFS 4000Mb 95% CP CS UN PA FC
d: cd CDFS 498Mb 100% CS TIPSTER_VOL_1
e: hd NTFS 10660Mb 19% CP CS UN PA FC
x: net NTFS 16159Mb 73% CP CS UN PA FC
C:\\bin /usr/bin user binmode
C:\\lib /usr/lib user binmode
C: / user binmode
Found: C:\bin\bash.exe
Found: \bin\bash.exe
Found: C:\bin\cat.exe
Found: \bin\cat.exe
Found: C:\bin\cpp.exe
Found: \bin\cpp.exe
Found: C:\bin\find.exe
Found: \bin\find.exe
Found: C:\bin\gcc.exe
Found: \bin\gcc.exe
Found: C:\bin\gdb.exe
Found: \bin\gdb.exe
Found: C:\bin\ld.exe
Found: \bin\ld.exe
Found: C:\bin\ls.exe
Found: \bin\ls.exe
Found: C:\bin\make.exe
Found: \bin\make.exe
Found: C:\bin\sh.exe
Found: \bin\sh.exe
83k 2000/06/11 C:\bin\cygitcl30.dll
35k 2000/06/11 C:\bin\cygitk30.dll
402k 2000/06/11 C:\bin\cygtcl80.dll
5k 2000/06/11 C:\bin\cygtclpip80.dll
10k 2000/06/11 C:\bin\cygtclreg80.dll
639k 2000/06/11 C:\bin\cygtk80.dll
587k 2000/03/01 C:\bin\cygwin1.dll
Cygwin DLL version info:
dll major: 1001
dll minor: 0
dll epoch: 19
dll bad signal mask: 19005
dll old termios: 00005
api major: 0
api minor: 17
shared data: 3
dll identifier: cygwin1
mount registry: 2
cygnus registry name: Cygnus Solutions
cygwin registry name: Cygwin
program options name: Program Options
cygwin mount registry name: mounts v2
build date: Wed Mar 1 00:15:19 EST 2000
snapshot date: 2000-02-29-23:55-EST
shared id: cygwin1S3-2000-03-01 00:15:19
Bruce Rosen, Ph.D.
Chief Scientist, Oingo Inc
10474 Santa Monica Bl.
Los Angeles, CA 90025
Phone: (310) 446 8162
E-mail: rosen@oingo.com
----------------------------------------------------------------------------
------------
The information contained in this email is Confidential, and is intended for
the recipient's review only. Any unauthorized review, use, disclosure or
distribution is not allowed. If you are not the intended recipient, please
contact the sender by email and destroy all copies of the original message.
More information about the Cygwin
mailing list