forum.alglib.net

ALGLIB forum
It is currently Sat Nov 23, 2024 3:51 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Using AMP
PostPosted: Wed Feb 20, 2013 12:33 pm 
Offline

Joined: Tue Feb 19, 2013 2:19 pm
Posts: 5
Hello.

I'd like to use the AMP library. And I have some troubles.

I use MVSC 2010 Express. To use the AMP I add gmp.h, mpfr.h, ap.h, amp.h header files into the project.
Then I add amp.cpp and ap.cpp. Next I compile ap.cpp. But amp.cpp isn't compiled:

"e:\cprogs\amprf\amp.h(24): fatal error C1083: Cannot open include file: gmp.h: No such file or directory"


Top
 Profile  
 
 Post subject: Re: Using AMP
PostPosted: Wed Feb 20, 2013 12:58 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
You have to add gmp.h into search path of your project... or store in the same directory where you store the rest of the library.


Top
 Profile  
 
 Post subject: Re: Using AMP
PostPosted: Wed Feb 20, 2013 1:09 pm 
Offline

Joined: Tue Feb 19, 2013 2:19 pm
Posts: 5
It seems the problem is solved by changing include directories. Because amp.h includes gmp.h like #include <>.
But project doesn't work.

I try to compile following code

Code:
#include "amp.h"
int i=3;
    amp::ampf<128> a(i);
   void main () {
   }


As a result of this:

Quote:
1.obj : error LNK2019: unresolved external symbol _mpfr_set_si referenced in function "private: void __thiscall amp::ampf<128>::InitializeAsSLong(long)" (?InitializeAsSLong@?$ampf@$0IA@@amp@@AAEXJ@Z)
1.obj : error LNK2019: unresolved external symbol _mpfr_set4 referenced in function "public: struct __mpfr_struct * __thiscall amp::ampf<128>::getWritePtr(void)" (?getWritePtr@?$ampf@$0IA@@amp@@QAEPAU__mpfr_struct@@XZ)
amp.obj : error LNK2001: unresolved external symbol "_mpfr_set4"
amp.obj : error LNK2019: unresolved external symbol _mpfr_init2 referenced in function "public: static struct amp::mpfr_record * __cdecl amp::mpfr_storage::newMpfr(unsigned int)" (?newMpfr@mpfr_storage@amp@@SAPAUmpfr_record@2@I@Z)
amp.obj : error LNK2019: unresolved external symbol ___gmp_randseed_ui referenced in function"public: static struct __gmp_randstate_struct (* __cdecl amp::mpfr_storage::getRandState(void))[1]" (?getRandState@mpfr_storage@amp@@SAPAY00U__gmp_randstate_struct@@XZ)
amp.obj : error LNK2019: unresolved external symbol ___gmp_randinit_default referenced in function "public: static struct __gmp_randstate_struct (* __cdecl amp::mpfr_storage::getRandState(void))[1]" (?getRandState@mpfr_storage@amp@@SAPAY00U__gmp_randstate_struct@@XZ)


I think it means I make something wrong.

P.S. AlgLib version 3 is more simple to use, but I need the amp.

In the third version of AlgLib LNK2019 problem is solved by including all .cpp files. But in this version there are just ap.cpp and amp.cpp.

Also I didn't use build.bat and I don't know how to use it.

Attempt of including static libraries results in error LNK2005.


Top
 Profile  
 
 Post subject: Re: Using AMP
PostPosted: Wed Feb 20, 2013 3:24 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
You also need MPFR, library which supports arbitrary precision transcendent functions.


Top
 Profile  
 
 Post subject: Re: Using AMP
PostPosted: Fri Feb 22, 2013 5:14 am 
Offline

Joined: Tue Feb 19, 2013 2:19 pm
Posts: 5
Sergey.Bochkanov wrote:
You also need MPFR, library which supports arbitrary precision transcendent functions.


If it's msvc-x86-mpfr.lib from "_internal" folder than I add it to the project as "Additional Dependencies". Also I add msvc-x86-gmp.lib.

But :

Code:
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
1>LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(strtol.obj) : error LNK2005: _strtol already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMT.lib(strnicmp.obj) : error LNK2005: __strnicmp already defined in MSVCRTD.lib(MSVCR90D.dll)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group