3

I am trying to solve a coupled set of ODE's in C++, and I have decided that I want to try out odeint (available here) as I have read many good things about it. However I am having compiling the examples that are included in the package. Here is the situation:

So far I have only downloaded the package and extracted it. I am running Visual C++ 6 on Windows XP and I am compiling the example "simple1d". I get the error message: "Cannot open include file: 'boost/config.hpp': No such file or directory".

It is not clear to me what I am missing. Do I need the full boost library to make this work? I was under the impression that ODEINT is a "standalone" package.

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
BillyJean
  • 1,537
  • 1
  • 22
  • 39

3 Answers3

3

Your error says that compiler can not find the boost libraries. You should download them from boost.org and also add them to your header path.

headmyshoulder
  • 6,240
  • 2
  • 20
  • 27
  • Now I am linking to both ODEINT and BOOST and then I get 10 errors and 3192 warnings (?!). One of the errors are (as an example): "c:\boost_1_51_0\boost\utility\swap.hpp(37) : error C2265: '' : reference to a zero-sized array is illegal" – BillyJean Oct 15 '12 at 15:27
  • Can you try another example? Simple1d is some kind of special. Although I did not experienced any problems until now. – headmyshoulder Oct 15 '12 at 15:31
  • Yes, I just tried "solar_system.cpp". Now I get 4 errors (no warnings), and one of them is: "error C2039: 'abort' : is not a member of 'std'" – BillyJean Oct 15 '12 at 15:35
  • Hmm, maybe Visual Studio 6 is too old, maybe not. We never heard from people having problems with MSVC. Maybe your try a newer version of MSVC? They come with a Express variant which is free. – headmyshoulder Oct 15 '12 at 15:40
  • I'll try -- I will let you know how it turns out. – BillyJean Oct 15 '12 at 15:45
  • Well, visual c++ 6 was released in 1998! Maybe, indeed, newer versions of boost aren't supported for such ancient IDEs. Does trivial code compile? Like including the boost headers but with a trivial main function? Does the "'abort' : is not a member of 'std'" message go away if you `#include `? – Zorawar Oct 15 '12 at 16:06
  • OK, I updated to MSVC++ 2010 and now the examples work. When I build and compile it usually takes 2-3 seconds, is that normal? It seems like a long time, but then again - there are many files in the library. – BillyJean Oct 15 '12 at 18:44
  • Two or three seconds is ok. odeint heavily uses the C++ template system which usually results in higher compilation timer but better run times. – headmyshoulder Oct 16 '12 at 10:10
1

Where did you download and extract the package to? The package homepage says that it's a header-only package, so you only need to let Visual find the header files. I haven't used Visual in a while, but a quick google of something like "Visual 6 add header path" should be a good place to start. Take a look at Where does Visual Studio look for C++ header files?.

Quoting from this page:

Within Visual Studio, go to the Project Settings dialog. We want to change the settings for both Debug and Release versions, so under the Settings For field, select "All Configurations". Under the C/C++ Tab, select Preprocessor options.

The package tarball has a directory called boost: you want to add the path of that directory into the Additional include directories box and then #include <boost/numeric/odeint/config.hpp> in your code.

Update

It appears, then, that you already have the odeint headers installed properly: the file boost/numeric/odeint/config.hpp has a line #include <boost/config.hpp>, which is what visual must be complaining about; so I guess the package is not standalone. It must need other boost header files installed. I can't find anything in either the package homepage or the package tarball that mentions any dependencies, so I suppose you should try to install boost too. Download version 1.51.0 here, and this is the windows documentation.

Community
  • 1
  • 1
Zorawar
  • 6,505
  • 2
  • 23
  • 41
0

You must download odeint from http://headmyshoulder.github.io/odeint-v2/downloads.html and Boost c++ libraries from http://www.boost.org/users/history/version_1_51_0.html. If you use codeblocks right click your project, select build oprions, select Search Directories and add two references one for odeint and one for boost.