Hi Chris

Yes it is working finally after i added for it to compile with
openbabel-2.lib.

Thanks alot for the help!

I wanted to output the InChi to a string but why is the string always empty?


  OpenBabel::OBConversion conv(&ifs, &ofs);
  OpenBabel::OBMol obMol;
  conv.ReadFile(&obMol, inputmolfile);

  if(!conv.SetInAndOutFormats("MOL","INCHI"))
  {
    cout << "Formats not available\n";
    return 1;
  }
  conv.Write(&obMol);

  string temp = conv.WriteString(&obMol);

Thank you and have a nice weekend!

On Sat, Feb 12, 2011 at 9:20 PM, Chris Morley-3 [via Open Babel] <
ml-node+3303083-1666310929-213...@n4.nabble.com> wrote:

> On 12/02/2011 19:27, Keng Cher Soh wrote:
>
> Hi Chris
>
> I installed the MSVC2008 feature pack and the ALLBUILT was built
> successfully.
>
> I think there is also a later service pack.
> I use Visual Studio's (Re)Build Solution to build OpenBabel.
>
> If i just want to use obconversion in my program, do i need to include ALL
> the openbabel .cpp and .h files into my program?
>
> when i only include obconversion.h and .cpp and tried to compile my code
> again, it gave me:
>
>
> The errors below are linker errors. The compiler must have worked ok with
> the header files you gave it, but the linker did not find the
> openbabel-2.lib.  In the property page of your project, go to Configuration
> Properties, Linker, Input, Additional Dependencies and make sure that that
> openbabel-2.lib is included there, with either a complete absolute path or a
> relative path from the project file. Have a look at the babel project, which
> also only uses OBConversion. Alternatively, I _think_ a lib file can also be
> added to the project (with the cpp files).
>
>
> 1>------ Build started: Project: WinNetGen, Configuration: Debug Win32
> ------
> 1>Linking...
> 1>obconversion.obj : error LNK2019: unresolved external symbol "public: int
> __thiscall OpenBabel::OBFormat::RegisterFormat(char const *,char const *)"
> (?RegisterFormat@OBFormat@OpenBabel@@QAEHPBD0@Z) referenced in function
> "public: static int __cdecl OpenBabel::OBConversion::RegisterFormat(char
> const *,class OpenBabel::OBFormat *,char const *)"
> (?RegisterFormat@OBConversion@OpenBabel@@SAHPBDPAVOBFormat@2@0@Z)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "public:
> static class OpenBabel::OBPlugin * __cdecl
> OpenBabel::OBPlugin::GetPlugin(char const *,char const *)"
> (?GetPlugin@OBPlugin@OpenBabel@@SAPAV12@PBD0@Z) referenced in function
> "protected: static int __cdecl
> OpenBabel::OBConversion::LoadFormatFiles(void)"
> (?LoadFormatFiles@OBConversion@OpenBabel@@KAHXZ)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "public:
> void __thiscall OpenBabel::OBMessageHandler::ThrowError(class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > const &,class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > const &,enum
> OpenBabel::obMessageLevel,enum OpenBabel::errorQualifier)"
> (?ThrowError@OBMessageHandler@OpenBabel@@QAEXABV?$basic_string@DU
> ?$char_traits@D@std@@V?$allocator@D@2@@std@@0W4obMessageLevel@2
> @W4errorQualifier@2@@Z) referenced in function "public: int __thiscall
> OpenBabel::OBConversion::Convert(void)" (?Convert@OBConversion@OpenBabel@
> @QAEHXZ)
> 1>obconversion.obj : error LNK2001: unresolved external symbol "class
> OpenBabel::OBMessageHandler OpenBabel::obErrorLog" (?obErrorLog@OpenBabel
> @@3VOBMessageHandler@1@A)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "protected:
> static class OpenBabel::OBPlugin * __cdecl
> OpenBabel::OBPlugin::BaseFindType(class std::map<char const *,class
> OpenBabel::OBPlugin *,struct OpenBabel::CharPtrLess,class
> std::allocator<struct std::pair<char const * const,class OpenBabel::OBPlugin
> *> > > &,char const *)" (?BaseFindType@OBPlugin@OpenBabel@@KAPAV12@AAV
> ?$map@PBDPAVOBPlugin@OpenBabel@@UCharPtrLess@2@V?$allocator@U
> ?$pair@QBDPAVOBPlugin@OpenBabel@@@std@@@std@@@std@@PBD@Z) referenced in
> function "public: static class OpenBabel::OBFormat * __cdecl
> OpenBabel::OBFormat::FindType(char const *)" (?FindType@OBFormat
> @OpenBabel@@SAPAV12@PBD@Z)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "public:
> static class OpenBabel::OBFormat * __cdecl
> OpenBabel::OBFormat::FormatFromMIME(char const *)" (?FormatFromMIME@OBFormat
> @OpenBabel@@SAPAV12@PBD@Z) referenced in function "public: static class
> OpenBabel::OBFormat * __cdecl OpenBabel::OBConversion::FormatFromMIME(char
> const *)" (?FormatFromMIME@OBConversion@OpenBabel@@SAPAVOBFormat@2@PBD@Z)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "public:
> void __thiscall OpenBabel::OBLocale::RestoreLocale(void)"
> (?RestoreLocale@OBLocale@OpenBabel@@QAEXXZ) referenced in function
> "public: bool __thiscall OpenBabel::OBConversion::Read(class
> OpenBabel::OBBase *,class std::basic_istream<char,struct
> std::char_traits<char> > *)" (?Read@OBConversion@OpenBabel@
> @QAE_NPAVOBBase@2@PAV?$basic_istream@DU?$char_traits@D@std@@@std@@@Z)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "public:
> void __thiscall OpenBabel::OBLocale::SetLocale(void)" (?SetLocale@OBLocale
> @OpenBabel@@QAEXXZ) referenced in function "public: bool __thiscall
> OpenBabel::OBConversion::Read(class OpenBabel::OBBase *,class
> std::basic_istream<char,struct std::char_traits<char> > *)"
> (?Read@OBConversion@OpenBabel@@QAE_NPAVOBBase@2@PAV?$basic_istream@DU
> ?$char_traits@D@std@@@std@@@Z)
> 1>obconversion.obj : error LNK2001: unresolved external symbol "class
> OpenBabel::OBLocale OpenBabel::obLocale" (?obLocale@OpenBabel
> @@3VOBLocale@1@A)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "public:
> static bool __cdecl OpenBabel::OBPlugin::ListAsVector(char const *,char
> const *,class std::vector<class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> >,class
> std::allocator<class std::basic_string<char,struct
> std::char_traits<char>,class std::allocator<char> > > > &)"
> (?ListAsVector@OBPlugin@OpenBabel@@SA_NPBD0AAV?$vector@V?$basic_string@DU
> ?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V
> ?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z)
> referenced in function "public: class std::vector<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> >,class std::allocator<class
> std::basic_string<char,struct std::char_traits<char>,class
> std::allocator<char> > > > __thiscall
> OpenBabel::OBConversion::GetSupportedInputFormat(void)"
> (?GetSupportedInputFormat@OBConversion@OpenBabel@@QAE?AV?$vector@V
> ?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@
> @V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@
> @std@@@2@@std@@XZ)
> 1>obconversion.obj : error LNK2019: unresolved external symbol "protected:
> static class std::map<char const *,class OpenBabel::OBPlugin *,struct
> OpenBabel::CharPtrLess,class std::allocator<struct std::pair<char const *
> const,class OpenBabel::OBPlugin *> > > & __cdecl
> OpenBabel::OBPlugin::GetTypeMap(char const *)" (?GetTypeMap@OBPlugin
> @OpenBabel@@KAAAV?$map@PBDPAVOBPlugin@OpenBabel@@UCharPtrLess@2
> @V?$allocator@U?$pair@QBDPAVOBPlugin@OpenBabel@@@std@@@std@@@std@@PBD@Z)
> referenced in function "public: static class std::_Tree<class
> std::_Tmap_traits<char const *,class OpenBabel::OBPlugin *,struct
> OpenBabel::CharPtrLess,class std::allocator<struct std::pair<char const *
> const,class OpenBabel::OBPlugin *> >,0> >::const_iterator __cdecl
> OpenBabel::OBPlugin::Begin(char const *)" (?Begin@OBPlugin@OpenBabel@
> @SA?AVconst_iterator@?$_Tree@V?$_Tmap_traits@PBDPAVOBPlugin@OpenBabel@
> @UCharPtrLess@2@V?$allocator@U?$pair@QBDPAVOBPlugin@OpenBabel@@@std@@@std@
> @$0A@@std@@@std@@PBD@Z)
> 1>..\WinNetGen\WinNetGen.exe : fatal error LNK1120: 11 unresolved externals
>
> thank you so much for your patience and help!
>
> On Sat, Feb 12, 2011 at 7:54 PM, kc <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=3303083&i=0>
> > wrote:
>
>>  Hi Chris
>>
>> I saved the lib file in the libs folder but still ALLBUILT couldn't
>> compile
>> C:\Projects\openbabel\openbabel-2-3-0\windows-vc2008\libs\i386
>>
>> some of the errors:
>> 1>------ Build started: Project: ZERO_CHECK, Configuration: Release Win32
>> ------
>> 1>Checking Build System
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/include/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/data/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/doc/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/src/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/src/formats/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/tools/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>CMake does not need to re-run because
>> C:/Projects/openbabel/openbabel-2-3-0/windows-vc2008/build/scripts/CMakeFiles/generate.stamp
>> is up-to-date.
>> 1>Build log was saved at
>> "file://c:\Projects\openbabel\openbabel-2-3-0\windows-vc2008\build\ZERO_CHECK.dir\Release\BuildLog.htm"
>> 1>ZERO_CHECK - 0 error(s), 0 warning(s)
>> 2>------ Build started: Project: openbabel, Configuration: Release Win32
>> ------
>> 2>Compiling...
>> 2>facade.cpp
>> 2>perception.cpp
>> 2>tetrahedral.cpp
>> 2>cistrans.cpp
>> 2>squareplanar.cpp
>> 2>tetraplanar.cpp
>> 2>tetranonplanar.cpp
>> 2>stereo.cpp
>> 2>vector3.cpp
>> 2>transform3d.cpp
>> 2>spacegroup.cpp
>> 2>matrix3x3.cpp
>> 2>svgpainter.cpp
>> 2>depict.cpp
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/shared_ptr.h(27)
>> : error C2039: 'shared_ptr' : is not a member of 'std::tr1'
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/shared_ptr.h(27)
>> : error C2873: 'shared_ptr' : symbol cannot be used in a using-declaration
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/alias.h(118) :
>> error C2065: 'shared_ptr' : undeclared identifier
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/alias.h(118) :
>> error C2275: 'OpenBabel::OBSmartsPattern' : illegal use of this type as an
>> expression
>> 2>
>> C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/parsmart.h(180) :
>> see declaration of 'OpenBabel::OBSmartsPattern'
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/alias.h(118) :
>> error C3203: 'pair' : unspecialized class template can't be used as a
>> template argument for template parameter '_Ty', expected a real type
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/alias.h(118) :
>> error C2955: 'std::pair' : use of class template requires template argument
>> list
>> 2>        C:\Program Files (x86)\Microsoft Visual Studio
>> 9.0\VC\include\utility(30) : see declaration of 'std::pair'
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/alias.h(118) :
>> error C2059: syntax error : '>'
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/alias.h(118) :
>> error C2238: unexpected token(s) preceding ';'
>> 2>C:\Projects\openbabel\openbabel-2-3-0\include\openbabel/alias.h(119) :
>> error C2061: syntax error : identifier 'SmartsTable'
>> 2>dlhandler_win32.cpp
>> 2>obmolecformat.cpp
>> ....
>>
>> Thanks alot for your help!
>>
>> best rgds
>> keng
>>
>>   On Sat, Feb 12, 2011 at 5:53 PM, Chris Morley-3 [via Open Babel] <[hidden
>> email] <http://user/SendEmail.jtp?type=node&node=3303008&i=0>> wrote:
>>
>>>   On 12/02/2011 15:02, kc wrote:
>>>
>>>  Hi Chris
>>>
>>> Thanks for your reply!
>>>
>>> I checked the build/src/Debug folder and it is empty. When i opened the
>>> openbabel solution and tried to build the ALL_BUILD, i had over 3000 errors
>>> (buildlog as attached).
>>>
>>> best rgds
>>>
>>>
>>>
>>>  *BuildLog.htm* (1M) Download 
>>> Attachment<http://attachment/3302769/0/BuildLog.htm?by-user=t>
>>>
>>>  I couldn't see your BuildLog with Thunderbird. I guess it is too big
>>> for the mailing list. I can't tell why you are having such bad problems.
>>>
>>> As an alternative, download 
>>> http://gaseq.co.uk/OB/2-3-0/openbabel-2.zipwhich contains the lib file to 
>>> be used with the DLL from the windows
>>> installer version.
>>>
>>>   Chris
>>>
>>>
>
> ------------------------------------------------------------------------------
>
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> OpenBabel-Devel mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=3303083&i=1>
> https://lists.sourceforge.net/lists/listinfo/openbabel-devel
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
> http://forums.openbabel.org/Problem-with-linking-tp3302682p3303083.html
>  To unsubscribe from Problem with linking, click 
> here<http://forums.openbabel.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3302682&code=a2VuZ2NoZXJAZ21haWwuY29tfDMzMDI2ODJ8LTg2NDM4NzczOA==>.
>
>

-- 
View this message in context: 
http://forums.openbabel.org/Problem-with-linking-tp3302682p3303455.html
Sent from the openbabel-devel mailing list archive at Nabble.com.
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to