'std::shared_ptr' has not been declared using std::shared_ptr and related errors

1,894 views
Skip to first unread message

Siddhartha Chandra

unread,
Jun 26, 2014, 2:20:17 PM6/26/14
to ceres-...@googlegroups.com
Hi Sameer,


I am getting the following error while trying to compile my project:

Admins-MacBook-Pro:spin3d siddharthachandra$ make

g++ -ggdb -m64 -I./ceres/include -I./ceres/config -I/usr/local/Cellar/eigen/3.2.1/include/eigen3 -I./blas/CBLAS/src -I./klt -Wno-deprecated -c path_ceres.cc -o path_ceres.o


In file included from ./ceres/include/ceres/types.h:42:0,


                 from ./ceres/include/ceres/sized_cost_function.h:41,


                 from ./ceres/include/ceres/autodiff_cost_function.h:134,


                 from ./ceres/include/ceres/ceres.h:37,


                 from path_ceres.cc:11:

./ceres/include/ceres/internal/port.h:62:12: error: 'std::shared_ptr' has not been declared

 
using std::shared_ptr;

           
^

In file included from ./ceres/include/ceres/ceres.h:54:0,

                 
from path_ceres.cc:11:

./ceres/include/ceres/solver.h:487:5: error: 'shared_ptr' does not name a type

     shared_ptr
<ParameterBlockOrdering> linear_solver_ordering;

     
^

./ceres/include/ceres/solver.h:595:5: error: 'shared_ptr' does not name a type

     shared_ptr
<ParameterBlockOrdering> inner_iteration_ordering;

     
^

make
: *** [path_ceres.o] Error 1


All libraries and paths are in place and I've installed the most recent version of ceres-solver from the Git repo for my project. Please can you suggest what I might be doing wrong if this error message looks familiar.

Here are the specs of the system that I am compiling my code on:

"Darwin Admins-MacBook-Pro.local 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64"

Please let me know in case any other details are needed from me.

Thanks,

Sid

Sameer Agarwal

unread,
Jun 26, 2014, 2:23:46 PM6/26/14
to ceres-...@googlegroups.com
Sid,
Can you post your cmake output? what version of xcode are you using?
Sameer



--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/cd7df584-8373-42e2-94a6-ef4556d43122%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sameer Agarwal

unread,
Jun 26, 2014, 2:44:42 PM6/26/14
to ceres-...@googlegroups.com
I think std:shared_ptr is in a non-standard place and you are not defining the appropriate defines for it. I recommend using cmake as your build system 

To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/CABqdRUDHMpmFLrLrKhxFx2rd4crV0_osaEvJfNVvtTR3MYWfCg%40mail.gmail.com.

Alex Stewart

unread,
Jun 26, 2014, 6:54:14 PM6/26/14
to ceres-...@googlegroups.com
To add to Sameer's point - the problem is that you're not using the version of config.h that was configured for your machine when you built Ceres

g++ -ggdb -m64 -I./ceres/include -I./ceres/config -I/usr/local/Cellar/eigen/3.2.1/include/eigen3-I./blas/CBLAS/src -I./klt -Wno-deprecated -c path_ceres.cc -o path_ceres.o

Specifically: -I./ceres/config would, assuming that 'ceres' in the above is the Ceres src directory, refer to the default, empty config.h.  If you compiled Ceres using CMake, then the configured config.h for your system will be: <ceres build dir>/config/ceres/internal/config.h and will be installed to the same location as the public headers when you install Ceres.  This version should have all the correct #defines for your system.

You said that you had installed Ceres, but from the above it looks like you're just using the headers from the Ceres src directory, not the installed versions - is this really what you meant?  Ceres has a proper uninstall target (ie make uninstall exists and works), so you can remove it cleanly / easily if you wanted to - you could also, as you're clearly using Homebrew just use: brew install ceres-solver [--HEAD] (assuming you've tapped homebrew/science) to get the latest version all managed by Homebrew.

You can definitely compile a project that uses Ceres but doesn't use CMake itself, but I would strongly recommend you install Ceres somewhere, and reference the installed version from your project.  You should also be aware that if you're using the miniglog option in Ceres you would need to -I<ceres install root>/include/ceres/internal/miniglog as well.  However, we _really strongly_ recommend you use the real glog when it's available for your OS.

-Alex

Siddhartha Chandra

unread,
Jun 29, 2014, 7:13:40 PM6/29/14
to ceres-...@googlegroups.com
Thanks Sameer and Lex for your insights!

The problem is resolved now. The issue was related with the compiler in use.
After tinkering around for a bit, I realized that the g++ on my machine, which I had updated to version 4.8( overriding the native clang++ compiler) in order to get openMP support, was causing the problem.

After compiling the project with 'c++' (which pointed to the native clang++ compiler) instead of 'g++', I was able to get a successful compilation.

Thanks again for the pointers!

Sid
Reply all
Reply to author
Forward
0 new messages