Question

I'm trying to compile a program which uses the alglib function pearsoncorr2.

Unfortunately I always get compilation errors like the following:

undefined reference to `alglib::real_1d_array::real_1d_array()'

I know that I have to compile all the dependencies of the alglib unit which contains the function I want to use. In my case it's statistics.h. I'm including all the necessary files (ap.h, statistics.h, alglibinternal.h, alglibmisc.h, linalg.h, specialfunctions.h) when compiling my program, but still I get these undefined reference errors.

I'm using g++ on linux.

What am I doing wrong?

Thanks in advance.

Was it helpful?

Solution

You also need to include the binary part -- i.e., either the *.o files or the *.so library file -- on your final link line. So for example, you probably need to link with linalg.o .

OTHER TIPS

Alglib needs to compile all 13 cpp files before using it.

I have CMakeList.txt to tare care all the dependencies for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top