This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: #include <Integer.h> // valid for GNU g++ Integer.h: No such fileor directory
- From: Morten Gulbrandsen <f1000mhz at yahoo dot de>
- To: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Cc: Brian Budge <brian dot budge at gmail dot com>
- Date: Tue, 22 Feb 2005 12:25:56 +0100
- Subject: Re: #include <Integer.h> // valid for GNU g++ Integer.h: No such fileor directory
- References: <421AF7AD.4070500@yahoo.de><5b7094580502220218401dd18a@mail.gmail.com>
Brian Budge wrote:
Hi Morten -
I can't say that I've heard of Integer.h before, and moreover none of
my linux systems have that header file.
Is it from a special library, perhaps akin to gnu multiple precision?
Brian
On Tue, 22 Feb 2005 10:13:17 +0100, Morten.Gulbrandsen
<f1000mhz@yahoo.de> wrote:
Please help,
how can I compile this ?
g++ -v
Reading specs from /opt/sfw/gcc-3/lib/gcc-lib/i386-pc-solaris2.9/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --prefix=/opt/sfw/gcc-3
--with-ld=/usr/ccs/bin/ld --with-as=/usr/ccs/bin/as --without-gnu-ld
--without-gnu-as --enable-shared
Thread model: posix
gcc version 3.3.2
#include <assert.h>
#include <iostream>
#include <Integer.h> // valid for GNU g++
using namespace std;
int main()
{
int i;
int n;
Integer product = 1;
// unsigned long long int product = 1;
cout << "The factorial of n will be computed.\n"
"\n"
"Input n: ";
cin >> n;
assert(cin && n >= 0);
for (i = 2; i <= n; ++i)
product *= i;
cout << "\n"
"factorial(" << n << ") = "
<< product << "\n"
"\n";
}
/*
bash-2.05$ g++ -ansi -pedantic -Wall -o main.out main.c -L
/opt/sfw/gcc-3/lib/ -R /opt/sfw/gcc-3/lib/ -lstdc++
main.c:5:53: Integer.h: No such file or directory
main.c: In function `int main()':
main.c:13: error: `Integer' undeclared (first use this function)
main.c:13: error: (Each undeclared identifier is reported only once for
each
function it appears in.)
main.c:13: error: parse error before `=' token
main.c:22: error: `product' undeclared (first use this function)
*/
best regards
Morten Gulbrandsen
===
Hi Brian, thank you,
I found it in some interesting code,
it should be possible to compute factorial 100 with it.
here I found more:
http://www.frenchfries.net/paul/factoring/source.html#gmplib
http://www.frenchfries.net/paul/src/Integer.h
http://www.frenchfries.net/paul/src/Integer.cc
Integer.h <http://www.frenchfries.net/paul/src/Integer.h>, and
Integer.cc <http://www.frenchfries.net/paul/src/Integer.cc>
This is a C++ Integer class that I threw together to make the gmp
library work like normal arithmetic. It lets you play with big integers
just like you would with |(int)| or |(long int)|. There is also a
.tar.gz <http://www.frenchfries.net/paul/src/Integer_class.tar.gz>
version available that includes small Makefile and demo test code.
Requires the GMP library
<http://www.frenchfries.net/paul/factoring/source.html#gmplib> from GNU.
The page looks nice and I would like to try it out.
The idea is to be able to make some ADT Integer with arbitrary
precicion.
factorial 100 - 10000 would be fine.
I first read about Integer.h in conjunction with gcc
from here :
http://www.cse.ucsc.edu/~pohl/abc4.html
The sources extracts to
bash-2.05$ cat READ_ME
---
The GNU C++ compiler, g++, provides the header file
Integer.h
for working with big integers. The latest versions
of the compiler requires that the library
libg++.a
be made available to it. We provide access via the
makefile.
bash-2.05$ cat makefile
CC = g++
CFLAGS = -Wall
EXEC = a.out
INCLS =
LIBS = -lg++ ## for the Integer type in Integer.h
OBJS = main.o
$(EXEC): $(OBJS)
@echo "linking ..."
@$(CC) $(CFLAGS) -o $(EXEC) $(OBJS) $(LIBS)
$(OBJS):
$(CC) $(CFLAGS) $(INCLS) -c $*.c
relink:
@echo "relinking ..."
@$(CC) $(CFLAGS) -o $(EXEC) $(OBJS) $(LIBS)
bash-2.05$ cat main.c
#include <assert.h>
#include <iostream.h>
#include <Integer.h> // valid for GNU g++
int main()
{
int i;
int n;
Integer product = 1;
cout << "The factorial of n will be computed.\n"
"\n"
"Input n: ";
cin >> n;
assert(cin && n >= 0);
for (i = 2; i <= n; ++i)
product *= i;
cout << "\n"
"factorial(" << n << ") = " << product << "\n"
"\n";
}
bash-2.05$
I don't think I did something wrong, but I must have missed something,
anyway I have two different version available.
bash-2.05$ /opt/sfw/bin/gcc -v
Reading specs from /opt/sfw/lib/gcc-lib/i386-pc-solaris2.9/2.95.3/specs
gcc version 2.95.3 20010315 (release)
bash-2.05$ which g++
/opt/sfw/gcc-3/bin/g++
bash-2.05$ g++ -v
Reading specs from /opt/sfw/gcc-3/lib/gcc-lib/i386-pc-solaris2.9/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --prefix=/opt/sfw/gcc-3
--with-ld=/usr/ccs/bin/ld --with-as=/usr/ccs/bin/as --without-gnu-ld
--without-gnu-as --enable-shared
Thread model: posix
gcc version 3.3.2
Please help
Best regards
Morten Gulbrandsen