Closed vishalsaraswat247 closed 1 year ago
Just for reference, in case anyone else runs into it. It's all about the simple ordering issue. We need to load the library before the compilation of the code, that's what's mentioned in g++ manual as well. :)
instance1:~/code/ngt/NGT$ g++ -std=c++11 -o construct construct.cpp -lngt
Maybe we could edit the command on the C++ quick start page as this doesn't occur immediately.
Thank you for your feedback. I updated the command you mentioned.
Is anyone else running into this linking issue? I was running into some other(but similar) issue when I was trying to use this library but then I tried building the sample code to check and ran into this similar issue.
instance1:~/ngt/NGT$ g++ -std=c++11 -o construct -lngt construct.cpp In file included from /usr/local/include/NGT/ObjectSpace.h:19, from /usr/local/include/NGT/ObjectSpaceRepository.h:21, from /usr/local/include/NGT/Node.h:21, from /usr/local/include/NGT/Tree.h:21, from /usr/local/include/NGT/Index.h:33, from construct.cpp:2: /usr/local/include/NGT/PrimitiveComparator.h:22:2: warning: #warning " SIMD is NOT available! " [-Wcpp] 22 | #warning " SIMD is NOT available! " | ^
~~/usr/bin/ld: /tmp/ccOnG8Mu.o: in function, std::allocator > const&, bool, bool)'
/usr/bin/ld: /tmp/ccOnG8Mu.o: in function `NGT::Index::createGraphAndTree(std:: cxx11::basic_string<char, std::char_traits, std::allocator > const&, NGT::Property&, bool)':
construct.cpp:(.text._ZN3NGT5Index18createGraphAndTreeERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_8PropertyEb[_ZN3NGT5Index18createGraphAndTreeERKNSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_8PropertyEb]+0x6c): undefined reference to `NGT::Index::createGraphAndTree(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, NGT::Property&, std:: cxx11::basic_string<char, std::char_traits, std::allocator > const&, unsigned long, bool)'
collect2: error: ld returned 1 exit status
NGT::Index::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)': construct.cpp:(.text._ZN3NGT5Index4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb[_ZN3NGT5Index4openERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEb]+0x2e): undefined reference to
NGT::Index::open(std::cxx11::basic_string<char, std::char_traitsI did try to check the code some more around the "open" issue. I do see that "open" in the header(Index.h) file but I'm not sure why it's not getting resolved. Just wondering if someone has fixed it already?