Problems with Examples

261 views
Skip to first unread message

Peter Friess

unread,
May 22, 2023, 7:57:08 AM5/22/23
to Ceres Solver
Hi All,

I am new to Ceres-Solver. I sucessfully installed it yesterday (version  2.1.0) via VCpkg for windows x64. I use VC 2022 Community.

Today, I wanted to compile the examples. I started with helloworld.cc and got immediately problems. I did not compile. I got e.g. the message:

error C4996: 'ceres::LocalParameterization': LocalParameterizations will be removed from the Ceres Solver API in version 2.2.0. Use Manifolds instead.

Well, LocalParameterizations is used internally by ceres. So, how can I make the official examples compile?

Hope someone can help.
Regards,
Peter
 

Sameer Agarwal

unread,
May 22, 2023, 9:19:15 AM5/22/23
to ceres-...@googlegroups.com
Peter,
2.1.0 is a transition release. You may need to pass a compiler option to ignore this warning. It is just a warning, it does not prevent the code from working. 
You are also welcome to use Ceres Solver at head which does not have this warning or LocalParameterization anymore.

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/afa78d09-8ab6-453a-9b3f-cc3505fc9244n%40googlegroups.com.

Peter Friess

unread,
May 23, 2023, 5:41:01 AM5/23/23
to Ceres Solver
Sameer,

Thanks for the quick resonse. However, even if I tell the compiler to ignore this warning, I still get tons of error messages when compiling helloworld.cc. See below.

No clue what I do wrong here, as I haven't written a single lineof code myself. Help is appreciated.

Peter


Build started...
1>------ Build started: Project: CeresSolver, Configuration: Release x64 ------
1>helloworld.cc
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): error C2589: '(': illegal token on right side of '::'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): error C3878: syntax error: unexpected token '(' following 'expression'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): message : error recovery skipped: '( ( identifier'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): error C2760: syntax error: ')' was unexpected here; expected ';'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): error C3878: syntax error: unexpected token ')' following 'expression_statement'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): message : error recovery skipped: ') >'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): message : error recovery skipped: ') ?'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): error C2760: syntax error: ':' was unexpected here; expected ';'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): error C3878: syntax error: unexpected token ':' following 'expression_statement'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): message : error recovery skipped: ':'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(343,16): message : error recovery skipped: ')'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\local_parameterization.h(325,3): message : This diagnostic occurred in the compiler generated function 'ceres::ProductParameterization::ProductParameterization(LocalParams *...)'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\gradient_problem_solver.h(255,37): warning C4251: 'ceres::GradientProblemSolver::Options::callbacks': class 'std::vector<ceres::IterationCallback *,std::allocator<ceres::IterationCallback *>>' needs to have dll-interface to be used by clients of struct 'ceres::GradientProblemSolver::Options'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\gradient_problem_solver.h(255,10): message : see declaration of 'std::vector<ceres::IterationCallback *,std::allocator<ceres::IterationCallback *>>'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\gradient_problem_solver.h(273,17): warning C4251: 'ceres::GradientProblemSolver::Summary::message': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of struct 'ceres::GradientProblemSolver::Summary'
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include\xstring(5155,29): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\gradient_problem_solver.h(284,35): warning C4251: 'ceres::GradientProblemSolver::Summary::iterations': class 'std::vector<ceres::IterationSummary,std::allocator<ceres::IterationSummary>>' needs to have dll-interface to be used by clients of struct 'ceres::GradientProblemSolver::Summary'
1>C:\Work\5 Software Development\Vcpkg\installed\x64-windows\include\ceres\gradient_problem_solver.h(284,10): message : see declaration of 'std::vector<ceres::IterationSummary,std::allocator<ceres::IterationSummary>>'
1>Done building project "CeresSolver.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 11:37 AM and took 03.283 seconds ==========

Sameer Agarwal

unread,
May 24, 2023, 9:28:41 AM5/24/23
to ceres-...@googlegroups.com
I think it is this problem, because min and max are macros in msvc.

I remember Sergiu fixing a bunch of this stuff before the 2.1.0 release last year. But maybe we missed a few cases?

Sameer


Sameer Agarwal

unread,
May 24, 2023, 9:31:01 AM5/24/23
to ceres-...@googlegroups.com, Sergiu Deitsch
+Sergiu Deitsch should have a suggestion on how to deal with this (I do not use msvc).

Alex

unread,
May 26, 2023, 10:42:19 AM5/26/23
to Ceres Solver
I faced the same issue trying to build a sample '/examples/helloworld.cc' when I installed ceres-solver via vcpkg recently. Defining NOMINMAX has resolved the issue, the 'helloword' was compiled successfully, and it runs smoothly.

 Sameer, thank you for this hint! 

Alex

#define NOMINMAX
#define GLOG_NO_ABBREVIATED_SEVERITIES
#define CERES_MSVC_USE_UNDERSCORE_PREFIXED_BESSEL_FUNCTIONS
#pragma warning(disable: 4996)

#include "ceres/ceres.h"
#include "glog/logging.h"


Sergiu Deitsch

unread,
May 27, 2023, 2:48:57 PM5/27/23
to ceres-...@googlegroups.com
Unless you are compiling Ceres sources outside of its CMake workspace, setting the macro should not be necessary; we already define NOMINMAX at the project level: https://github.com/ceres-solver/ceres-solver/blob/bdee4d6172b940c9c2b46dda863baec0e6fc3308/CMakeLists.txt#L641-L648. However, since local_parameterization.h is a public header, the min/max macro expansion issue will persist. This can be avoided either by defining NOMINMAX in your own project or by suppressing macro expansion of remaining min/max occurrences. I probably missed/ignored those because the corresponding interface was scheduled to be removed (and in fact no longer exists.)

Sergiu

Reply all
Reply to author
Forward
0 new messages