Yingfeng,
you have forgotten to link against the rdkit libraries. If you are using
the InChI code, you need to link against: RDInchiLib, InChi, GraphMol, and
RDGeneral. There may be a few others as well.
-greg
On Sat, Mar 12, 2016 at 5:13 AM, Yingfeng Wang <ywang...@gmail.com> wrote:
> After installing RDKit, I try to compile the following code in main.cpp,
>
> #include <iostream>
> #include <INCHI-API/inchi.h>
>
> using namespace RDKit;
> using namespace std;
>
> int main(int argc, const char * argv[]) {
> string curInchi =
> "InChI=1S/C10H9N3O/c1-7-11-10(14)9(13-12-7)8-5-3-2-4-6-8/h2-6H,1H3,(H,11,12,14)";
> InchiToInchiKey(curInchi);
> //cout << "Hello, World!" << endl;
> return 0;
> }
>
> with the following command,
>
> g++ -Wall -O2 -std=c++11 -I
> /Users/yingfeng/software/RDKit/rdkit-Release_2015_03_1/Code -I
> /Users/yingfeng/software/RDKit/rdkit-Release_2015_03_1/External -I
> /usr/local/Cellar/boost/1.60.0_1/include -o MYTEST main.cpp
>
> on my maverick Macbook. The RDKit has been installed at
>
> /Users/yingfeng/software/RDKit/rdkit-Release_2015_03_1/
>
> while boost is at
> /usr/local/Cellar/boost/1.60.0_1/
>
> The compiler information is
>
> g++ -v
> Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr
> --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
> Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
> Target: x86_64-apple-darwin13.4.0
> Thread model: posix
>
> However, I got the following the error message.
>
> Undefined symbols for architecture x86_64:
> "RDKit::InchiToInchiKey(std::__1::basic_string<char,
> std::__1::char_traits<char>, std::__1::allocator<char> > const&)",
> referenced from:
> _main in main-dd8650.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>
> I am very sure inchi.h and inchi.cpp are available at
> /Users/yingfeng/software/RDKit/rdkit-Release_2015_03_1/External/INCHI-API/
>
> and function
> std::string InchiToInchiKey(const std::string &inchi)
>
> is defined in inchi.cpp.
>
> Could you please give me some hints for solving this problem?
>
> Thanks.
>
> Yingfeng
>
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss