{"action":"created","issue":{"url":"https://api.github.com/repos/OpenANN/OpenANN/issues/171","labels_url":"https://api.github.com/repos/OpenANN/OpenANN/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/OpenANN/OpenANN/issues/171/comments","events_url":"https://api.github.com/repos/OpenANN/OpenANN/issues/171/events","html_url":"https://github.com/OpenANN/OpenANN/issues/171","id":59957908,"number":171,"title":"insert lib with openANN in java project","user":{"login":"Lupen2002","id":3455182,"avatar_url":"https://avatars.githubusercontent.com/u/3455182?v=3","gravatar_id":"","url":"https://api.github.com/users/Lupen2002","html_url":"https://github.com/Lupen2002","followers_url":"https://api.github.com/users/Lupen2002/followers","following_url":"https://api.github.com/users/Lupen2002/following{/other_user}","gists_url":"https://api.github.com/users/Lupen2002/gists{/gist_id}","starred_url":"https://api.github.com/users/Lupen2002/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lupen2002/subscriptions","organizations_url":"https://api.github.com/users/Lupen2002/orgs","repos_url":"https://api.github.com/users/Lupen2002/repos","events_url":"https://api.github.com/users/Lupen2002/events{/privacy}","received_events_url":"https://api.github.com/users/Lupen2002/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-05T14:23:05Z","updated_at":"2015-03-05T15:07:08Z","closed_at":null,"body":"Could anybody help me solve the problem. I'm trying to use the library openANN in Java, but upon compilation, I receieve the following error:\r\n```\r\n/usr/lib/jvm/java-7-openjdk-amd64/bin/java: symbol lookup error: /home/user/workspace/opneANN_java_test/libfor_java_test.so: undefined symbol: _ZN7OpenANN3NetC1Ev\r\n```\r\nfor_java-test.cpp:\r\n```\r\n#include <OpenANN/io/DirectStorageDataSet.h>\r\n#include <OpenANN/util/Random.h>\r\n#include <Eigen/Core>\r\n#include <iostream>\r\n#include <eigen3/Eigen/src/Core/Matrix.h>\r\n#include <OpenANN/Net.h>\r\n#include <OpenANN/Convenience.h>\r\n#include \"com_centreit_NativeAnn.h\"\r\n\r\nusing namespace OpenANN;\r\n\r\nJNIEXPORT void JNICALL Java_com_centreit_NativeAnn_run(JNIEnv *env, jclass myclass) {\r\n    const int d = 4;\r\n    const int f = 4;\r\n    const int n = 18;\r\n    Eigen::MatrixXd x(n, d);\r\n    Eigen::MatrixXd t(n, f);\r\n    x <<\r\n            2, 0, 0, 0,\r\n            2, 0, 0, 1,\r\n            2, 0, 1, 1,\r\n            2, 0, 1, 2,\r\n            2, 1, 0, 2,\r\n            2, 1, 0, 1,\r\n            1, 0, 0, 0,\r\n            1, 0, 0, 1,\r\n            1, 0, 1, 1,\r\n            1, 0, 1, 2,\r\n            1, 1, 0, 2,\r\n            1, 1, 0, 1,\r\n            0, 0, 0, 0,\r\n            0, 0, 0, 1,\r\n            0, 0, 1, 1,\r\n            0, 0, 1, 2,\r\n            0, 1, 0, 2,\r\n            0, 1, 0, 1;\r\n    t <<\r\n            0, 0, 1, 0,\r\n            0, 0, 1, 0,\r\n            1, 0, 0, 0,\r\n            1, 0, 0, 0,\r\n            0, 0, 0, 1,\r\n            1, 0, 0, 0,\r\n            0, 0, 1, 0,\r\n            0, 0, 0, 1,\r\n            1, 0, 0, 0,\r\n            0, 0, 0, 1,\r\n            0, 0, 0, 1,\r\n            0, 0, 0, 1,\r\n            0, 0, 1, 0,\r\n            0, 0, 0, 1,\r\n            0, 0, 0, 1,\r\n            0, 1, 0, 0,\r\n            0, 1, 0, 0,\r\n            0, 0, 0, 1;\r\n    Net net;\r\n    makeMLNN(net, LOGISTIC, LOGISTIC, d, f, 1, 1200);\r\n    net.trainingSet(x, t);\r\n    Eigen::VectorXd v(4);\r\n    v << 2, 0, 0, 0;\r\n    Eigen::VectorXd out = net(v);\r\n    std::cout << out << std::endl;\r\n}\r\n```\r\nwhat could be the problem?"},"comment":{"url":"https://api.github.com/repos/OpenANN/OpenANN/issues/comments/77379673","html_url":"https://github.com/OpenANN/OpenANN/issues/171#issuecomment-77379673","issue_url":"https://api.github.com/repos/OpenANN/OpenANN/issues/171","id":77379673,"user":{"login":"AlexanderFabisch","id":869592,"avatar_url":"https://avatars.githubusercontent.com/u/869592?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexanderFabisch","html_url":"https://github.com/AlexanderFabisch","followers_url":"https://api.github.com/users/AlexanderFabisch/followers","following_url":"https://api.github.com/users/AlexanderFabisch/following{/other_user}","gists_url":"https://api.github.com/users/AlexanderFabisch/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexanderFabisch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexanderFabisch/subscriptions","organizations_url":"https://api.github.com/users/AlexanderFabisch/orgs","repos_url":"https://api.github.com/users/AlexanderFabisch/repos","events_url":"https://api.github.com/users/AlexanderFabisch/events{/privacy}","received_events_url":"https://api.github.com/users/AlexanderFabisch/received_events","type":"User","site_admin":false},"created_at":"2015-03-05T15:07:08Z","updated_at":"2015-03-05T15:07:08Z","body":"Hi @Lupen2002,\r\n\r\nthis seems like your code can be compiled but the linker complains about a missing definition of OpenANN::Net. Did you link the shared library? Usually pkgconfig should tell you what you have to do:\r\n\r\n    $ pkg-config --cflags --libs openann\r\n    -I/usr/local/include/eigen3 -I/usr/local/include/OpenANN -I/usr/local/include/alglib -I/usr/local/include  -L/usr/local/lib -lopenann -lgomp\r\n\r\nUnfortunately I did not work with JNI before. I cannot really help you."}}