forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 8:03 am

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: unresolved external symbol error
PostPosted: Fri Apr 08, 2011 12:31 pm 
Offline

Joined: Thu Oct 07, 2010 5:00 am
Posts: 3
Hello,

Thanks for creating ALGLIB!

I'm getting the following error:
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl alglib::polynomialbar2pow(class alglib::barycentricinterpolant const &,class alglib::real_1d_array &)" (?polynomialbar2pow@alglib@@YAXABVbarycentricinterpolant@1@AAVreal_1d_array@1@@Z) referenced in function _main

When I compile the following code in MS Visual C++ 2008 Express:

Code:


#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "interpolation.h"

using namespace alglib;


int main(int argc, char **argv)
{
   real_1d_array x = "[-4.71, -3.77, -2.83, -1.89, -0.25]";
  real_1d_array y = "[0, 1, 2, 3, 4]";
  ae_int_t m = 3;
  double t = 0;
  ae_int_t info;
  barycentricinterpolant p;
  polynomialfitreport rep;
  double v;
  polynomialfit(x, y, m, info, p, rep);
  v = barycentriccalc(p, t);
  printf("%.2f\n", double(v));
  real_1d_array a_eqdist;
  polynomialbar2pow(p, a_eqdist);
  printf("%s\n", a_eqdist.tostring(4).c_str());
  return 0;
}


Please advise because I'm not sure what I'm doing wrong.

Thanks and regards,
Michael


Top
 Profile  
 
 Post subject: Re: unresolved external symbol error
PostPosted: Fri Apr 08, 2011 1:24 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
I think that you've forgot to add one of the ALGLIB files to your project. You have to add all .cpp files from ALGLIB's /cpp/src folder.


Top
 Profile  
 
 Post subject: Re: unresolved external symbol error
PostPosted: Fri Apr 08, 2011 1:47 pm 
Offline

Joined: Thu Oct 07, 2010 5:00 am
Posts: 3
Thanks for the response!

I copied and pasted all 27 files from the /cpp/src folder to the project, but I'm getting the same error message. I'll play around with this more - there must be something I'm doing wrong.

A good weekend to you!


Top
 Profile  
 
 Post subject: Re: unresolved external symbol error
PostPosted: Fri Apr 08, 2011 1:51 pm 
Offline

Joined: Thu Oct 07, 2010 5:00 am
Posts: 3
Er um *sheepish grin* I think I found the problem. I was using an older version of ALGLIB in the test program and then added the latest version to test the "polynomialbar2pow" function. The error message disappeared after I'd rebuilt the solution.

Sorry about that!


Top
 Profile  
 
 Post subject: Re: unresolved external symbol error
PostPosted: Fri Apr 08, 2011 1:52 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
BTW, it is better to add .cpp files to your project as is, not to copy/paste them.


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 28 guests


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