how to connect the library alglib in QT C++

拈花ヽ惹草 提交于 2020-01-16 01:06:08

问题


I want to run the example from the official site link. When I am trying to compile

mlptrainer trn;
multilayerperceptron network;
mlpreport rep;
real_1d_array x = "[0]";
real_1d_array y = "[0,0]";
real_2d_array xy = "[[+1,0],[+2,0],[-1,1],[-2,1],[0,0],[0,1]]";
mlpcreatetrainercls(1, 2, trn);
mlpcreatec1(1, 5, 2, network);
mlpsetdataset(trn, xy, 6);
mlptrainnetwork(trn, network, 5, rep);

I get an many errors they all look

C:\Qt\Tools\QtCreator\bin\VK_DotaFeed\neuralnet.cpp:-1: error: undefined reference to alglib::mlpcreatetrainercls(int, int, alglib::mlptrainer&)

C:\Qt\Tools\QtCreator\bin\VK_DotaFeed\neuralnet.cpp:-1: errors: undefined reference to alglib::real_1d_array::~real_1d_array()

I wrote

using namespace alglib;
#include "dataanalysis.h"

In what an error?


回答1:


Download the library you need for your project here;

http://www.alglib.net/download.php

Read section 4 and the first part of section 8 on the page you reference above.

Your problem is that the library has not been linked into the application. You will have to add two lines to the PRO file of your Qt project to tell Qt where to find the library that you downloaded and the headers for the library. They will look like this;

INCLUDEPATH += /Users/sysadmin/programming/alglib/includes/???? LIBS += -L/Users/sysadmin/programming/alglib/libs -l?????

where you will use names for your system, not mine, and replace the ??? with the library names.



来源:https://stackoverflow.com/questions/34579459/how-to-connect-the-library-alglib-in-qt-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!