Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

libfann.so having undefined references to floor, exp, etc.

Help
W.S.
2014-06-11
2014-06-11
  • W.S.
    W.S.
    2014-06-11

    Hello,
    So, I am using FANN on ubuntu 14, and upon compiling a program identical to the example program on the FANN site, I get the following error (I also included math.h but that did not seem to help):

    will@ubuntu:~/FANN/FANNtest$ g++ main.cpp -o main -lfann -lm
    //usr/local/lib/libfann.so: undefined reference to `sin'
    //usr/local/lib/libfann.so: undefined reference to `exp'
    //usr/local/lib/libfann.so: undefined reference to `cos'
    //usr/local/lib/libfann.so: undefined reference to `log'
    //usr/local/lib/libfann.so: undefined reference to `pow'
    //usr/local/lib/libfann.so: undefined reference to `sqrt'
    //usr/local/lib/libfann.so: undefined reference to `floor'
    collect2: error: ld returned 1 exit status
    

    How can I ensure that the references are, in fact, defined? Posts of similar problems nodded to possibly an issue with the CMake configuration, but, I am not sure.

     
  • W.S.
    W.S.
    2014-06-11

    Also, I can compile the examples in the FANN-2.2.0-Source folder, but I get a symbol lookup error like this when running xor_train:

    will@ubuntu:~/FANN/FANN-2.2.0-Source/examples$ make all
    gcc -O3 xor_train.c -o xor_train -lfann -lm
    gcc -O3 xor_test.c -o xor_test -lfann -lm
    gcc -O3 -DFIXEDFANN xor_test.c -o xor_test_fixed -lfixedfann -lm
    gcc -O3 simple_train.c -o simple_train -lfann -lm
    gcc -O3 steepness_train.c -o steepness_train -lfann -lm
    gcc -O3 simple_test.c -o simple_test -lfann -lm
    gcc -O3 robot.c -o robot -lfann -lm
    gcc -O3 mushroom.c -o mushroom -lfann -lm
    gcc -O3 cascade_train.c -o cascade_train -lfann -lm
    gcc -O3 scaling_test.c -o scaling_test -lfann -lm
    gcc -O3 scaling_train.c -o scaling_train -lfann -lm
    will@ubuntu:~/FANN/FANN-2.2.0-Source/examples$ ./xor_train
    Creating network.
    ./xor_train: symbol lookup error: /usr/local/lib/libfann.so.2: undefined symbol: pow
    

    Just figured this information may be helpful as well.

     
    Last edit: W.S. 2014-06-11