forum.alglib.net
http://forum.alglib.net/

Unable to build the application: Linking error LNK2019
http://forum.alglib.net/viewtopic.php?f=2&t=497
Page 1 of 1

Author:  RAKU_2011 [ Wed Nov 30, 2011 1:39 pm ]
Post subject:  Unable to build the application: Linking error LNK2019

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
// POLINT subpackage for more info).
//
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.

Author:  Sergey.Bochkanov [ Wed Nov 30, 2011 7:40 pm ]
Post subject:  Re: Unable to build the application: Linking error LNK2019

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.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/