Hi,

 

Thank you Greg for posting the Jam compile options, and thank you Igor for the 
gcc ones.

 

This confirmed that I was including the right libraries already, so I persisted 
and found what the problem was. I was compiling the option in 'Debug' mode, 
while my RDKit libraries were not. So, although it compiled and linked 
properly, the debugger was getting confused at runtime.
 
I've now cleaned things up and can build Greg Landrum's GettingStarted C++ 
sample using the Visual Studio IDE - in both Debug and Release configurations. 
 
I thought this might be useful for others (if any!) using Visual Studio or 
Visual C++ Express, so here are all the steps I went through for setting up the 
VC++ solution:
 
Being able to build in 'Debug' mode is not strictly necessary. If you're only 
interested in building in 'Release' mode, then ignore the [PREPARATION] section 
and the first pass through steps 9 to 14.
 
[PREPARATION]
 
* Boost Build (boost_1_37_0, installed in C:\boost)
   Compile boost twice to populate the C:\boost\lib directory with both release 
and debug libraries:
      1. Go to c:\boost\boost_1_37_0 and execute ".\bjam.exe --toolset=msvc 
--with-thread --with-python release install"
      2. Go to c:\boost\boost_1_37_0 and execute ".\bjam.exe --toolset=msvc 
--with-thread --with-python debug install"
      3. Check that C:\boost\lib contains both release and debug libraries 
('*-gd-*.lib' for debug libraries)
 
* RDKit Build (RDKit Q42008, installed in C:\RDKit)
   Compile RDKit twice to build relase and debug libraries:
      1. Go to C:\RDKit\Code and execute "c:\boost\boost_1_37_0\bjam.exe 
--toolset=msvc debug"
      2. Copy C:\RDKit\bin to C:\RDKit\bin_debug
      3. Copy C:\RDKit\External\vflib-2.0\lib to 
C:\RDKit\External\vflib-2.0\lib_debug
      4. Go to C:\RDKit\Code and build release version by executing 
"c:\boost\boost_1_37_0\bjam.exe --toolset=msvc release"
 
[VC++ PROJECT]
 
* Build Greg Landrum's GettingStarted sample program from the Visual Studio IDE 
 
   1. Open Visual C++ 2008 Express edition
   2. Create a new project with File/New/Project
   3. Select Project type 'Win32/Win32 Console Application'
   4. In the 'Win32 Application Wizard', select 'Application Settings' and 
un-tick 'Precompiled header'
   5. Removed auto-generated files 'stdafx.h', 'targetver.h', 'stdafx.cpp', 
'Readme.txt'
   6. Open GettingStartedVCpp.cpp and replace with content of 
C:\RDKit\Code\Demos\RDKit\GettingStarted\sample.cpp
   7. Alt+F7 to open the Project Properties Pages

   8. Open the Configuration dropdown list ans select 'Debug'

 

      9. Open 'Configuration Properties/C/C++/General'

      10. Set 'Additional Include Directories' to 
"C:\boost\include\boost1_37";"C:\RDKit\Code";"C:\RDKit\External\vflib-2.0\include"
      11. Open 'Configuration Properties/Linker/General'
      12. Set 'Additional Library Dependencies' to 
"C:\boost\lib";"C:\RDKit\bin_debug";"C:\RDKit\External\vflib-2.0\lib_debug"
      13. Open Linker/Input
      14. Set 'Additional Dependencies' to
          libRDGeneral.lib
          libRDGeometry.lib
          libGraphMol.lib
          libSmilesParse.lib
          libSubstruct.lib
          libDepictor.lib
          libDataStructs.lib
          libFileParsers.lib
          libvf.lib

 

   15. Open the Configuration dropdown list and select 'Release'
   16. Repeat above steps 9 to 14, but use 
"C:\boost\lib";"C:\RDKit\bin";"C:\RDKit\External\vflib-2.0\lib" in step 12

   17. Exit the Project Property Pages
   
   18. Build the solution
 
The ZIP file for the whole Visual C++ 2008 project implementing Greg's 
sample.cpp is ~800KB and is too large for a standard post to the mailing list 
so I have sent it to the mailing list's moderator who will try to make it 
available separately.


Thank you all for the help on this thread.
 
George.

 
> Date: Tue, 24 Feb 2009 05:56:04 +0100
> Subject: Re: [Rdkit-discuss] Developing on Visual C++
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> 
> George,
> 
> On Sat, Feb 21, 2009 at 10:17 AM, George Oakman <[email protected]> wrote:
> >
> > Thanks for looking into that. Yes, my piece of code is so simple that it
> > must be a problem with the way I compile and link.
> 
> I just built your sample code by saving it to
> $RDBASE/Code/Demos/RDKit/GettingStarted/oakman.cpp and adding the
> following to the Jamfile in that directory:
> 
> exe oakman : oakman.cpp
> ../../../GraphMol//GraphMol
> ../../../DataStructs//DataStructs 
> ../../../RDGeneral//RDGeneral ../../../Geometry//RDGeometry
> ../../..//lapacklibs
> ;
> 
> This compiles with MSVC++ and runs without error in both debug and
> release modes.
> 
> The libraries I link against (GraphMol, DataStructs, RDGeneral,
> RDGeometry, and lapack) may help you figure out which projects you
> should add as dependencies in Visual Studio.
> 
> -greg

_________________________________________________________________
View your Twitter and Flickr updates from one place – Learn more!
http://clk.atdmt.com/UKM/go/137984870/direct/01/

Reply via email to