0

I have downloaded the Alglib library and I have created a Console Application with VS2019, then under Project->proprieties->C/C++->General->Additional include directories I added the path to the src directory of Alglib containing the .h and .cpp files.

My main is as simple as this:

#include <iostream>
#include "interpolation.h"
int main()
{
   alglib::real_1d_array x;
   std::cout << "Hello World!\n";
}

But when I compile, I get this errors:

1>ConsoleApplication2.obj : error LNK2019: riferimento al simbolo esterno "public: __thiscall alglib::real_1d_array::real_1d_array(void)" (??0real_1d_array@alglib@@QAE@XZ) non risolto nella funzione _main

1>ConsoleApplication2.obj : error LNK2019: riferimento al simbolo esterno "public: virtual __thiscall alglib::real_1d_array::~real_1d_array(void)" (??1real_1d_array@alglib@@UAE@XZ) non risolto nella funzione _main

1>C:\Users\matti\source\repos\ConsoleApplication2\Debug\ConsoleApplication2.exe : fatal error LNK1120: 2 esterni non risolti

1>Compilazione progetto "ConsoleApplication2.vcxproj" NON COMPLETATA.

What am I doing wrong?

Mattia
  • 135
  • 3
  • 13
  • 1
    It appears that Aglib comes with a manual, which has an "Adding to your project" section. Did you follow those instructions? – Drew Dormann Jan 08 '22 at 21:53
  • ***By "adding to your project" we mean that you should a) compile .cpp files with the rest of your project, and b) include .h files you need. Do not include .cpp files - these files must be compiled separately, not as part of some larger source file. The only files you should include are .h files, stored in the /src folder of the ALGLIB distribution.*** Did you add all of the `.cpp` files from aglib that you are using to your project? Including the headers is only the first step. – drescherjm Jan 08 '22 at 23:47
  • [https://www.alglib.net/translator/man/manual.cpp.html#gs_attaching](https://www.alglib.net/translator/man/manual.cpp.html#gs_attaching) – drescherjm Jan 08 '22 at 23:53

0 Answers0