문제

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.

도움이 되었습니까?

해결책

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 .

다른 팁

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top