# forum.alglib.net

ALGLIB forum
 It is currently Thu Jul 25, 2024 1:17 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.

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Unable to build the application: Linking error LNK2019Posted: Wed Nov 30, 2011 1:39 pm

Joined: Wed Nov 30, 2011 1:28 pm
Posts: 1
I am trying to run the following code using Microsoft visual studio 2010 and Operating system: Microsoft windows XP. While running the code I am getting the errors which are mentioned below the code. Could you please help me in this regard and let me know about the steps to be followed to succesfully build and run this application using ALGLIB library.

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

using namespace alglib;

int main(int argc, char **argv)
{
//
// This example demonstrates polynomial fitting.
//
// Fitting is done by two (M=2) functions from polynomial basis:
// f0 = 1
// f1 = x
// Basically, it just a linear fit; more complex polynomials may be used
// (e.g. parabolas with M=3, cubic with M=4), but even such simple fit allows
// us to demonstrate polynomialfit() function in action.
//
// We have:
// * x set of abscissas
// * y experimental data
//
// Additionally we demonstrate weighted fitting, where second point has
// more weight than other ones.
//
real_1d_array x = "[0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0]";
real_1d_array y = "[0.00,0.05,0.26,0.32,0.33,0.43,0.60,0.60,0.77,0.98,1.02]";
ae_int_t m = 2;
double t = 2;
ae_int_t info;
barycentricinterpolant p;
polynomialfitreport rep;
double v;

//
// Fitting without individual weights
//
// NOTE: result is returned as barycentricinterpolant structure.
// if you want to get representation in the power basis,
// you can use barycentricbar2pow() function to convert
// from barycentric to power representation (see docs for
//
polynomialfit(x, y, m, info, p, rep);

v = barycentriccalc(p, t);
printf("%.2f\n", double(v)); // EXPECTED: 2.011

//
// Fitting with individual weights
//
// NOTE: slightly different result is returned
//
real_1d_array w = "[1,1.414213562,1,1,1,1,1,1,1,1,1]";
real_1d_array xc = "[]";
real_1d_array yc = "[]";
integer_1d_array dc = "[]";
polynomialfitwc(x, y, w, xc, yc, dc, m, info, p, rep);
v = barycentriccalc(p, t);
printf("%.2f\n", double(v)); // EXPECTED: 2.023
return 0;
}

I am getting following errors:
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall alglib::barycentricinterpolant::~barycentricinterpolant(void)" (??1barycentricinterpolant@alglib@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall alglib::polynomialfitreport::~polynomialfitreport(void)" (??1polynomialfitreport@alglib@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall alglib::real_1d_array::~real_1d_array(void)" (??1real_1d_array@alglib@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall alglib::integer_1d_array::~integer_1d_array(void)" (??1integer_1d_array@alglib@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl alglib::polynomialfitwc(class alglib::real_1d_array const &,class alglib::real_1d_array const &,class alglib::real_1d_array const &,class alglib::real_1d_array const &,class alglib::real_1d_array const &,class alglib::integer_1d_array const &,int,int &,class alglib::barycentricinterpolant &,class alglib::polynomialfitreport &)" (?polynomialfitwc@alglib@@YAXABVreal_1d_array@1@0000ABVinteger_1d_array@1@HAAHAAVbarycentricinterpolant@1@AAVpolynomialfitreport@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall alglib::integer_1d_array::integer_1d_array(char const *)" (??0integer_1d_array@alglib@@QAE@PBD@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "double __cdecl alglib::barycentriccalc(class alglib::barycentricinterpolant const &,double)" (?barycentriccalc@alglib@@YANABVbarycentricinterpolant@1@N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "void __cdecl alglib::polynomialfit(class alglib::real_1d_array const &,class alglib::real_1d_array const &,int,int &,class alglib::barycentricinterpolant &,class alglib::polynomialfitreport &)" (?polynomialfit@alglib@@YAXABVreal_1d_array@1@0HAAHAAVbarycentricinterpolant@1@AAVpolynomialfitreport@1@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall alglib::polynomialfitreport::polynomialfitreport(void)" (??0polynomialfitreport@alglib@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall alglib::barycentricinterpolant::barycentricinterpolant(void)" (??0barycentricinterpolant@alglib@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall alglib::real_1d_array::real_1d_array(char const *)" (??0real_1d_array@alglib@@QAE@PBD@Z) referenced in function _main
fatal error LNK1120: 11 unresolved externals
1>
1>Build FAILED.

Top

 Post subject: Re: Unable to build the application: Linking error LNK2019Posted: Wed Nov 30, 2011 7:40 pm

Joined: Fri May 07, 2010 7:06 am
Posts: 921
You have to add all .cpp files from the ALGLIB/src folder to your project. These error messages tell you that a lot of functions were defined, but not implemented.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 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 forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for: