i'm trying to use fann library in qt environment.i make a project to test a simple example of fann and add "LIBS += -L/usr/local/lib -lfann" to ".pro file" but whenever try to run example i countered with this error :
undefined reference to 'sin' libfann.so
undefined reference to 'exp' libfann.so
undefined reference to 'log' libfann.so
undefined reference to 'cos' libfann.so
undefined reference to 'pow' libfann.so
undefined reference to 'sqrt' libfann.so
undefined reference to 'floor' libfann.so
. . . it seems there is a problem with mathematics function,but how should fix it?
Ok, eventually found the mistake. It is a matter of linking the library.
There are several ways to solve it:
Copy the required .h and .c file from fann and add them into your project(for example if you run xor example you should copy and paste the fann.h and fann.c directly to your project)
The better way: Build the static library "libfann.a" and add it to the project.
Build it, following:
Add it:
# after add_executable(${PROJECT_NAME} "main.cpp")
link_directories(/usr/local/lib) # -L flags
target_link_libraries(${PROJECT_NAME} fann) # -l flags