Hello. I am a beginner in C++ and Ceres solver.
So, I tried to solve this problem but I couldn't.
This is my code,
#pragma comment ( lib, "ceres.lib" )
#pragma comment ( lib, "libglog.lib" )
#include "C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres\ceres.h"
#include "glog/logging.h"
using ceres::AutoDiffCostFunction;
using ceres::CostFunction;
using ceres::Problem;
using ceres::Solver;
using ceres::Solve;
// A templated cost functor that implements the residual r = 10 -
// x. The method operator() is templated so that we can then use an
// automatic differentiation wrapper around it to generate its
// derivatives.
struct CostFunctor {
template <typename T> bool operator()(const T* const x, T* residual) const {
residual[0] = T(10.0) - x[0];
return true;
}
};
int main(int argc, char** argv) {
google::InitGoogleLogging(argv[0]);
// The variable to solve for with its initial value. It will be
// mutated in place by the solver.
double x = 0.5;
const double initial_x = x;
// Build the problem.
And this is errors,
C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1115): error C2447: '{' : missing function header (old-style formal list?)
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1269): error C2504: 'google::LogMessage' : base class undefined
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1279): error C2514: 'google::LogMessage' : class has no constructors
1> C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1115) : see declaration of 'google::LogMessage'
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1279): error C2228: left of '.stream' must have class/struct/union
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1305): error C2504: 'google::LogMessage' : base class undefined
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1539): error C2027: use of undefined type 'google::LogMessage'
1> C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1115) : see declaration of 'google::LogMessage'
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1539): error C2504: 'LogStream' : base class undefined
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1545): error C2027: use of undefined type 'google::LogMessage'
1> C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1115) : see declaration of 'google::LogMessage'
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1545): error C2614: 'google::NullStream' : illegal member initialization: 'LogStream' is not a base or member
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1548): error C2027: use of undefined type 'google::LogMessage'
1> C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1115) : see declaration of 'google::LogMessage'
1>C:\Users\shim\Desktop\ceres\glog\src\windows\glog/logging.h(1548): error C2614: 'google::NullStream' : illegal member initialization: 'LogStream' is not a base or member
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/solver.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>C:\Users\shim\Desktop\ceres\ceres-solver-1.9.0\include\ceres/types.h : warning C4819: The file contains a character that cannot be represented in the current code page (949). Save the file in Unicode format to prevent data loss
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.49
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
How can I solve this problem? Is there anyone who can help me??