headmyshoulder / odeint-v2

odeint - solving ordinary differential equations in c++ v2
http://headmyshoulder.github.com/odeint-v2/
Other
340 stars 101 forks source link

odeint unable to compile without std=c++0x #116

Closed ghost closed 10 years ago

ghost commented 10 years ago

I just had my issue solved on stackexchange - http://stackoverflow.com/questions/19875527/canot-compile-c-which-uses-odeint-from-boost

I had to manually get the latest boost from sourceforge which shipped with odeint and it compiled successfully with both g++ and nvcc nvcc -o example -Xcompiler "-std=c++0x" example.cpp

I have gcc v4.6.3 on ubuntu and 4.7 on Mac. In both cases the following example failed to compile without the `std=c++0x' flag.

I guess its not able to fall back to boost::bind

The example in the stackoverflow thread was indeed from an older version and I changed it to use this which worked with C11 compiler options only -> http://pastebin.com/kY9sPALf

Awesome job with odeint btw :)

headmyshoulder commented 10 years ago

Your example compiles perfectly fine for me with g++-4.7 and g++-4.6 and without -std=c++0x. Can you paste your exact output and the compilation command?

On 09.11.2013 18:06, Pinaki Kumar wrote:

I just had my issue solved on stackexchange - http://stackoverflow.com/questions/19875527/canot-compile-c-which-uses-odeint-from-boost

I had to manually get the latest boost from sourceforge which shipped with odeint and it compiled successfully with both g++ and nvcc |nvcc -o example -Xcompiler "-std=c++0x" example.cpp|

I have gcc v4.6.3 on ubuntu and 4.7 on Mac. In both cases the following example failed to compile without the `std=c++0x' flag.

I guess its not able to fall back to boost::bind

The example in the stackoverflow thread was indeed from an older version and I changed it to use this which worked with C11 compiler options only -> http://pastebin.com/kY9sPALf

Awesome job with odeint btw :)

— Reply to this email directly or view it on GitHub https://github.com/headmyshoulder/odeint-v2/issues/116.

ghost commented 10 years ago

yoda@cluster:~$ g++ -o example -Wfatal-errors example.cpp In file included from /usr/include/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp:25:0, from /usr/include/boost/numeric/odeint/stepper/euler.hpp:23, from /usr/include/boost/numeric/odeint.hpp:27, from example.cpp:15: /usr/include/boost/numeric/odeint/util/bind.hpp:44:14: error: ‘std::bind’ has not been declared compilation terminated due to -Wfatal-errors. yoda@cluster:~$ g++ --version g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

yoda@cluster:~$ g++ -o example -std=c++0x -Wfatal-errors example.cpp yoda@cluster:~$ ./example

1 0 1.00843 0.0125618 1.0197 0.0291282 1.03098 0.0454238 1.04226 0.0614569 1.05409 0.0779974`

headmyshoulder commented 10 years ago

Hmm, it seems that boost.config does not work correctly for your setup. There is a define BOOST_NO_CXX11_HDR_FUNCTIONAL which checks if the C++11 header is available at your machine. It looks like this define is not set, alotough you don't have a C++11 compiler. I will look what boost says about this issue.

On 09.11.2013 19:17, Pinaki Kumar wrote:

`yoda@cluster:~$ g++ -o example -Wfatal-errors example.cpp In file included from /usr/include/boost/numeric/odeint/stepper/base/explicit_stepper_base.hpp:25:0, from /usr/include/boost/numeric/odeint/stepper/euler.hpp:23, from /usr/include/boost/numeric/odeint.hpp:27, from example.cpp:15: /usr/include/boost/numeric/odeint/util/bind.hpp:44:14: error: ‘std::bind’ has not been declared compilation terminated due to -Wfatal-errors. yoda@cluster:~$ g++ --version g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

yoda@cluster:~$ g++ -o example -std=c++0x -Wfatal-errors example.cpp yoda@cluster:~$ ./example 1 0 1.00843 0.0125618 1.0197 0.0291282 1.03098 0.0454238 1.04226 0.0614569 1.05409 0.0779974 `

— Reply to this email directly or view it on GitHub https://github.com/headmyshoulder/odeint-v2/issues/116#issuecomment-28133203.

ghost commented 10 years ago

Thanks for looking into it. This is my setup info, hope this helps:- -Release 12.04 (precise) 64-bit, Kernel Linux 3.8.0-32-generic -Vanilla install with only the CUDA toolkit v5.5 installed to use Thrust libraries -I have replaced the boost from ubuntu repos with the latest version i.e. boost 1.55.0 b1 -Processor - AMD Phenom II X6, 16 GB DDR3 RAM, Nvidia GeForce GTX TITAN

Update :- I have tried out several codes from boost. All of them compiled successfully without the C++11 flag with the exception of odeint and regex libraries

headmyshoulder commented 10 years ago

On 09.11.2013 19:39, Pinaki Kumar wrote:

Thanks for looking into it. This is my setup info, hope this helps:- -Release 12.04 (precise) 64-bit, Kernel Linux 3.8.0-32-generic -Vanilla install with only the CUDA toolkit v5.5 installed to use Thrust libraries -I have replaced the boost from ubuntu repos with the latest version i.e. boost 1.55.0 b1

could you try boost.1.54?

-Processor - AMD Phenom II X6, 16 GB DDR3 RAM, Nvidia GeForce GTX TITAN

— Reply to this email directly or view it on GitHub https://github.com/headmyshoulder/odeint-v2/issues/116#issuecomment-28133711.

ghost commented 10 years ago

Compiled all examples with boost 1.54 without using C11 flags. Seems there is a problem with v1.55.0 Thanks