<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#993399">
Sisyphus wrote:
<blockquote cite="mid:CFE21150CD874E2588C2F73A0A756FE8@desktop2"
 type="cite"><br>
----- Original Message ----- From: "Duke Hound"
<a class="moz-txt-link-rfc2396E" href="mailto:dukethek9@gmail.com">&lt;dukethek9@gmail.com&gt;</a>
  <br>
.
  <br>
.
  <br>
  <blockquote type="cite">
    <blockquote type="cite">Hello,
      <br>
I decided to reinstall msys and start again.
      <br>
Details:
      <br>
-Windows XP SP2
      <br>
-I have MinGW (gcc version 3.4.5 (mingw-vista special)) at
      <br>
C:\Program Files\CodeBlocks\MinGW\
      <br>
-I have MSYS 1.0.10 at
      <br>
C:\msys\1.0\
      <br>
-In C:\msys\1.0\etc\fstab i have the following mount setting:
      <br>
"c:/progra~1/codeblocks/mingw /mingw"
      <br>
-I have unzipped GMP 4.2.2 to
      <br>
C:\msys\1.0\home\dan\gmp-4.2.2
      <br>
      <br>
======PART 1 BUILD ===========
      <br>
[note: the msys make is 3.79.1 built for i686-pc-msys , whereas the
      <br>
mingw32-make is GNU Make 3.81 built for i386-pc-mingw32]
      <br>
      <br>
my commands (with the new setup as described above) (output of these
      <br>
commands are attached in the .zip)
      <br>
./configure --enable-cxx
      <br>
make
      <br>
make check
      <br>
      <br>
When I build this I do not get any DLL files, even though I do not
      <br>
provide the '--disable-shared --enable-static' switches.&nbsp; Please
explain?
      <br>
    </blockquote>
  </blockquote>
  <br>
My mistake. I thought dynamic libs were the default, but when I look at
the ./configure output you provided with your original post I see:
  <br>
  <br>
checking whether to build shared libraries... no
  <br>
checking whether to build static libraries... yes
  <br>
  <br>
That's why you get only static libraries.
  <br>
I expect that, for dynamic libs, you'll need to run:
  <br>
  <br>
./configure --disable-static --enable-shared --enable-cxx
  <br>
  <br>
That should produce a correctly functioning dll - though, as I
mentioned earlier, 'make check' doesn't work for me when I build
dynamic libs. (I prefer static libs anyway.)
  <br>
  <br>
  <blockquote type="cite">
    <blockquote type="cite">During the make I receive the following
warnings which i think are
      <br>
related to PART 2 of this email.
      <br>
      <br>
libtool: link: warning: undefined symbols not allowed in
      <br>
athlon-pc-mingw32 shared libraries
      <br>
libtool: link: warning: undefined symbols not allowed in
      <br>
athlon-pc-mingw32 shared libraries
      <br>
    </blockquote>
  </blockquote>
  <br>
They're just warnings, and can be ignored.
  <br>
  <br>
  <blockquote type="cite">
    <blockquote type="cite"><br>
make check seemed to pass.
      <br>
    </blockquote>
  </blockquote>
  <br>
If you run 'make install' then gmp.h should be installed into
C:/msys/1.0/local/include, and the libs should be installed into
C:/msys/1.0/local/lib. You access them from the command line using the
'-I', '-L', and '-l' switches.
  <br>
  <br>
  <blockquote type="cite">
    <blockquote type="cite">Now, I am trying to use the library that i
just built.
      <br>
      <br>
Here is the simple code
      <br>
#include &lt;gmpxx.h&gt;
      <br>
using namespace std;
      <br>
int main() {
      <br>
mpz_class a;
      <br>
a = 1234;
      <br>
cout &lt;&lt; a &lt;&lt; endl;
      <br>
return 0;
      <br>
}
      <br>
      <br>
    </blockquote>
  </blockquote>
  <br>
Assuming that file is called 'test.cpp', and that you've run 'make
install', you would build that (in the msys shell) by running:
  <br>
  <br>
g++ -o mytest.exe test.cpp -I/usr/local/include -L/usr/local/lib
-lgmpxx
  <br>
  <br>
If you're in the cmd.exe shell, then /usr/local/include and
/usr/local/lib won't be understood so it becomes:
  <br>
  <br>
g++ -o mytest.exe test.cpp -IC:/msys/1.0/local/include
-LC:/msys/1.0/local/lib -lgmpxx
  <br>
  <br>
(Just replace 'mytest.exe' and 'test.cpp' with whatever is
appropriate.)]
  <br>
  <br>
.
  <br>
.
  <br>
  <blockquote type="cite">-I saw the following from the GMP
documentation
    <br>
"MINGW uses the C runtime library `msvcrt.dll' for I/O, so applications
    <br>
wanting to use the GMP I/O routines must be compiled with `cl /MD' to
do
    <br>
the same. If one of the other C runtime library choices provided by MS
C
    <br>
is desired then the suggestion is to use the GMP string functions and
    <br>
confine I/O to the application. "
    <br>
Could this be the reason for the undefined references?&nbsp; If so how do I
    <br>
"complie with the `cl /MD`"?&nbsp; Do I have to use ./configure CFLAGS=cl
/MD?
    <br>
  </blockquote>
  <br>
'cl' is the microsoft compiler. That advice is for those who want to
build their apps using Visual Studio as the compiler. It doesn't apply
to you as you are using the MinGW compiler.
  <br>
  <br>
Cheers,
  <br>
Rob <br>
</blockquote>
Hello,<br>
Thanks for sticking with me through this.&nbsp; After issuing the make
install command and executing the compile command from within msys, I
received similar 'undefined reference to' errors as I did when trying
to compile from within codeblocks.&nbsp; The references it is trying to find
are (i think) all in the libgmpxx.a file.&nbsp; The linker can resolve
definitions stated in libgmp.a, but not from libgmpxx.a.&nbsp; This suggests
to me that c runtime libraries were compiled during the make, but the
c++ runtime libraries were not.<br>
<br>
Below is the output from trying to compile the test code within msys.<br>
<br>
<font face="Palatino Linotype">$ g++ -o mytest.exe test.cpp
-I/usr/local/include -L/usr/local/lib -lgmpxx<br>
C:/DOCUME~1/dan/LOCALS~1/Temp/cc37G8yA.o:test.cpp:(.text$_ZN10__gmp_exprIA1_12__mpz_structS1_ED1Ev[__gmp_expr&lt;__mpz_struct
[1], __mpz_struct [1]&gt;::~__gmp_expr()]+0xd): undefined reference to
`___gmpz_clear'<br>
C:/DOCUME~1/dan/LOCALS~1/Temp/cc37G8yA.o:test.cpp:(.text$_ZN10__gmp_exprIA1_12__pz_structS1_EaSEi[__gmp_expr&lt;__mpz_struct
[1], __mpz_struct [1]&gt;::operator=(int)]+0x14): undefined reference
to `___gmpz_set_si'<br>
C:/DOCUME~1/dan/LOCALS~1/Temp/cc37G8yA.o:test.cpp:(.text$_ZN10__gmp_exprIA1_12__mpz_structS1_EC1Ev[__gmp_expr&lt;__mpz_struct
[1], __mpz_struct [1]&gt;::__gmp_expr()]+0xd): undefined reference to
`___gmpz_init'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osmpz.o):osmpz.cc:(.text+0x39):
undefined reference to `___gmpz_get_str'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x65):
undefined reference to `___gmp_allocate_func'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x9d):
undefined reference to `___gmp_doprnt_integer'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0xa9):
undefined reference to `___gmp_asprintf_final'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0xcd):
undefined reference to `___gmp_free_func'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x125):
undefined reference to `___gmp_free_func'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osdoprnti.o):osdoprnti.cc:(.text+0x164):
undefined reference to `___gmp_free_func'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x4):
undefined reference to `___gmp_asprintf_memory'<br>
C:/msys/1.0/local/lib/libgmpxx.a(osfuns.o):osfuns.cc:(.rdata+0x8):
undefined reference to `___gmp_asprintf_reps'<br>
collect2: ld returned 1 exit status<br>
<br>
Look forward to learning/figuring this out. <br>
<br>
Thanks,<br>
</font>
</body>
</html>