[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
linking gmp(xx) in visual studio 2k5
From: |
execrable |
Subject: |
linking gmp(xx) in visual studio 2k5 |
Date: |
31 Mar 2007 11:22:21 -0700 |
User-agent: |
G2/1.0 |
Hey experienced people,
I have been trying to get gmp and it's c++ wrapper to work from Visual
Studio 2005 so I can add the capability to a program I have been
writing. Anyway, it's taken a couple days but I got static libraries
built on my system two ways:
1) The first set I got by simply installing MSYS and MinGW and
compiling, then adding the two *.a files in the Project Properties.
2) The second set I got using Brian Gladman's "Building GMP and MPFR
with Microsoft Visual Studio 2005 and YASM", and added the two *.lib
files to the project properties.
I didn't use them both at the same time, I tried one, then the other.
I used the following simple code to test compile:
#include <conio.h>
#include <gmpxx.h>
#include <iostream>
using std::cout;
int main()
{
mpz_class i;
i = 6;
cout << i;
_getch();
return 0;
}
When I try to compile with the second set of libraries (*.lib), vc2k5
gives me:
1>Linking...
1>gmpxx.lib(get_str.obj) : error LNK2019: unresolved external symbol
___gmpn_get_str referenced in function ___gmpz_get_str
1>gmpxx.lib(get_str.obj) : error LNK2001: unresolved external symbol
___gmpn_bases
1>.\Release/testconsole.exe : fatal error LNK1120: 2 unresolved
externals
When I try to compile with the first set of libraries (*.a), vc2k5
gives me:
1>Linking...
1>libgmp.a(memory.o) : warning LNK4217: locally defined symbol __iob
imported in function ___gmp_default_allocate
1>listiter.obj : error LNK2019: unresolved external symbol "class
std::basic_ostream<char,struct std::char_traits<char> > & __cdecl
operator<<(class std::basic_ostream<char,struct std::char_traits<char>
> &,struct __mpz_struct const *)" (??6@YAAAV?$basic_ostream@DU?
$char_traits@D@std@@@std@@AAV01@PBU__mpz_struct@@@Z) referenced in
function "class std::basic_ostream<char,struct std::char_traits<char>
> & __cdecl operator<<<struct __mpz_struct [1]>(class
std::basic_ostream<char,struct std::char_traits<char> > &,class
__gmp_expr<struct __mpz_struct [1],struct __mpz_struct [1]> const
&)" (??$?6$$BY00U__mpz_struct@@@@YAAAV?$basic_ostream@DU?
$char_traits@D@std@@@std@@AAV01@ABV?$__gmp_expr@$$BY00U__mpz_struct@@$
$BY00U1@@@@Z)
1>.\Release/testconsole.exe : fatal error LNK1120: 1 unresolved
externals
Now if I try "g++ -lgmpxx -lgmp" code.cpp inside MSYS with the *.a
files, it compiles and runs, so I am guessing there is a configuration
problem, but I am not very experienced with these types of things.
I'm not sure why the *lib files would give that particular error.
Any experience/help/insight would be much appreciated.
Thanks.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- linking gmp(xx) in visual studio 2k5,
execrable <=