forum.alglib.net http://forum.alglib.net/ |
|
get alglib running http://forum.alglib.net/viewtopic.php?f=2&t=148 |
Page 1 of 1 |
Author: | Hugo [ Wed Jan 05, 2011 6:16 pm ] |
Post subject: | get alglib running |
Hello! I have problems initializing alglib. At first i wanted to try out the spline1d_d_linear example and copied the code nearly exactly. Code: //#include <stdafx.h> #include <stdlib.h> #include <stdio.h> #include <math.h> //#include <interpolation.h> #include "C:/Qt/projects/MyProject/alglib/src/interpolation.h" //<--this is the path to the place where i put all the c++-files using namespace alglib; int main(int argc, char **argv) { // // We use piecewise linear spline to interpolate f(x)=x^2 sampled // at 5 equidistant nodes on [-1,+1]. // real_1d_array x = "[-1.0,-0.5,0.0,+0.5,+1.0]"; real_1d_array y = "[+1.0,0.25,0.0,0.25,+1.0]"; double t = 0.25; double v; spline1dinterpolant s; // build spline spline1dbuildlinear(x, y, s); // calculate S(0.25) - it is quite different from 0.25^2=0.0625 v = spline1dcalc(s, t); printf("%.4f\n", double(v)); // EXPECTED: 0.125 return 0; } Like suggested in the manual I picked the packages I needed ... and added them to my project! Or do I need to install something first? Anyway I get a lot of warnings like: undefined reference to `alglib::real_1d_array::real_1d_array(char const*)' and finally an error message that the linking went wrong. I use: OS:Windows Vista Qt 4.5.2 (32 bit) Compiler:MinGw So what may be the problem? Thanks for your help! |
Author: | Sergey.Bochkanov [ Wed Jan 05, 2011 7:17 pm ] |
Post subject: | Re: get alglib running |
You've forgot to compile several dependencies of interpolation.cpp At least one of them - ap.cpp, which defines real_1d_array class - is missing. Take a look at the beginning of interpolation.h to get list of all ALGLIB units which are needed for successful compilation. |
Author: | Hugo [ Wed Jan 05, 2011 8:39 pm ] |
Post subject: | Re: get alglib running |
Thank you, Sergey. It works now. So i just have to add all the files i need for my splines, (which are: "ap.h" +"ap.cpp" "alglibinternal.h" +"alglibinternal.cpp" "alglibmisc.h" + "alglibmisc.cpp" "linalg.h" + "linalg.cpp" "solvers.h" +"solvers.cpp" "optimization.h" + "optimization.cpp" "specialfunctions.h" + "specialfunctions.cpp" "integration.h" + "integration.cpp" ) compile them once along with my project and then i can delete them? I thought it would do just to include the interpolation.h |
Author: | Sergey.Bochkanov [ Thu Jan 06, 2011 1:01 pm ] |
Post subject: | Re: get alglib running |
List of units is correct, but you shouldn't delete them after successful compilation. You may recompile your project in the future, with different compiler settings, so in any case you need these files. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |