forum.alglib.net http://forum.alglib.net/ |
|
C++ + Alglib - Some help needed http://forum.alglib.net/viewtopic.php?f=2&t=352 |
Page 1 of 1 |
Author: | Rydo [ Sun May 08, 2011 6:58 pm ] |
Post subject: | C++ + Alglib - Some help needed |
Hello! I have a problem adding libraries to my project. I've tried both "Add" and copying to the project folder, but got: Code: [ILINK32 Error] Error: Unresolved external 'alglib::cov2(alglib::real_1d_array&, alglib::real_1d_array&)' referenced from C:\USERS\RYDO\DESKTOP\TEST\DEBUG\WIN32\UNIT1.OBJ [ILINK32 Error] Error: Unresolved external 'alglib::pearsoncorr2(alglib::real_1d_array&, alglib::real_1d_array&)' referenced from C:\USERS\RYDO\DESKTOP\TEST\DEBUG\WIN32\UNIT1.OBJ [ILINK32 Error] Error: Unresolved external 'alglib::spearmancorr2(alglib::real_1d_array&, alglib::real_1d_array&)' referenced from C:\USERS\RYDO\DESKTOP\TEST\DEBUG\WIN32\UNIT1.OBJ [ILINK32 Error] Error: Unable to perform link How should I add ALGLIB to my project? Код Unit1.cpp Code: //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #pragma argsused #include "stdafx.h" #include "stdlib.h" #include "stdio.h" #include "conio.h" #include "math.h" #include "statistics.h" #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" using namespace alglib; TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { real_1d_array x = "[1,4,234,4,42,4]"; real_1d_array y = "[42,42,23,75,34,1]"; double v; v = cov2(x, y); Memo1->Lines->Add("Ковариация - " +FloatToStr(v)); v = pearsoncorr2(x, y); Memo1->Lines->Add("Пирсон - " +FloatToStr(v)); v = spearmancorr2(x, y); Memo1->Lines->Add("Спирман - " +FloatToStr(v)); } //--------------------------------------------------------------------------- Код Unit1.h Code: //--------------------------------------------------------------------------- #ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> //--------------------------------------------------------------------------- class TForm1 : public TForm { __published: // IDE-managed Components TButton *Button1; TMemo *Memo1; void __fastcall Button1Click(TObject *Sender); private: // User declarations public: // User declarations __fastcall TForm1(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif Thanks! |
Author: | Sergey.Bochkanov [ Mon May 09, 2011 10:12 am ] |
Post subject: | Re: C++ + Alglib - Some help needed |
Hello! Have you added .cpp files (ap.cpp, alglibinternal.cpp, other files) to your project? Simply copying .h files is not enough. P.S. I've translated your post from Russian to English :) This forum is Enlgish-only |
Author: | Rydo [ Mon May 09, 2011 12:19 pm ] |
Post subject: | Re: C++ + Alglib - Some help needed |
You were right! I`ve missed statistics.cpp) It works! Thank you very much! |
Author: | Sergey.Bochkanov [ Wed May 11, 2011 5:44 pm ] |
Post subject: | Re: C++ + Alglib - Some help needed |
You can use std::string or AnsiString (you seem to use C++ Builder) to concatenate your strings. These classes have c_str() method which returns char* which can be passed to array initializer. But in any case your code must work correctly. I will try to reproduce your error and will inform you about my results. You can subscribe to this topic to get notifications e-mailed to you. |
Author: | Rydo [ Wed May 11, 2011 5:51 pm ] |
Post subject: | Re: C++ + Alglib - Some help needed |
I'll try tomorrow) |
Author: | Rydo [ Fri May 13, 2011 10:26 am ] |
Post subject: | Re: C++ + Alglib - Some help needed |
AnsiString works) now i am going to create some procedures like: x="["; for (i=0,i<10,i++){ str1=FloatToStr(a[i])+","; x=strcat(x,str1);} y="]"; x=strcat(x,y); |
Author: | Rydo [ Tue May 24, 2011 1:04 pm ] |
Post subject: | Re: C++ + Alglib - Some help needed |
Thanks for help! I think ive done my programm) |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |