vs2015+64 bit WIN10 System Ceres-solver compilation

Source: Internet
Author: User

Keep track of the detours you've compiled ceres-solver and hope to help others.

The compilation process mainly refers to the following two blog posts, but there are still some big pits, I will emphasize later.

http://blog.csdn.net/streamchuanxi/article/details/52944652

http://blog.csdn.net/yizhou2010/article/details/52596280

1. Download the required libraries ceres-solver-1.11.0, Eigen, gflags-2.0, Glog-master

Specific self-surfing search, download and extract to the folder Ceres.

In the next compilation process, it is important to note that: do not make the platform changes, must be compiled under the win32/x86, or even if the final success can not be used!!!

2. Compiling Glog

After decompression directly with vs2015 open Google-glog.sln, version problem directly migrated.

Build failures primarily address the following two issues:

Question one:

" error C2375" snprintf ": redefine"

Workaround: Comment out the statement

"//extern int google_glog_dll_decl snprintf (char *str, size_t size,

//const char *format, ...); "

Question two:

" error C2084 function" int snprintf (char *const, const std::size_t,const char *const,...) " Already has a subject "

Workaround:

Also comment out statements

"//int snprintf (char *str, size_t size, const char *format, ...) {

Va_list ap;
Va_start (AP, format);
const int r = vsnprintf (str, size, format, AP);
Va_end (AP);
return R;
}”

3. Compiling gflags

Also use vs2015 to open Gfalgs.sln (high version seems to need to build the project with CMake and then compile).

There are several main issues:

Question one:

"Error C2375" snprintf ": redefined; different links libgflagsd:\ceres\gflags-2.0\src\windows\port.h60"

" error C2084 function" int snprintf (char *const, const std::size_t,const char *const,...) " Already has a subject "

Workaround: Ibid, comment out statement

Question two:

" error C3688 text suffix" PRIu64 "is invalid; text operator or text operator template not found "

Workaround:
Change "%" PRId32 to "%d"

Change "%" PRId64 to "%i64d"

Change "%" PRIu64 to "%i64u"

4. Compiling Ceres

Use CMake (if you do not use a link that can be referenced at the beginning)

Another: Eigen library directly decompression can, do not need to compile separately

The settings directory is as follows:

Eigen_include_dir for "D:\ceres\eigen"
Glog_include_dir for "D:\ceres\glog-master\src\windows"
Glog_library for "D:\ceres\glog-master\Debug\libglog.lib"
Gflags_include_dir for "D:\ceres\gflags-2.0"
Gflags_library for "D:\ceres\gflags-2.0\Debug\libgflags-debug.lib"

And here's the point:

You have to hook up the eigensparse in the options!!!

Otherwise, even the last successful build will fail in many cases.

Configuring done and generating done.

Finally, open Ceres.sln, generate all_build, no accident should be no problem.

5. Organize and use

All the required files have been generated, and the appropriate collation below can be used.

Create new include and Lib folders in the Ceres directory (easy to add items)

Copy the following files to the Include folder:

D:\ceres\ceres-solver-1.11.0\include\ceres

D:\ceres\ceres-solver-1.11.0\config\ceres\internal (Copy to D:\ceres\include\ceres\internal folder)

D:\ceres\glog-master\src\windows\glog

D:\ceres\gflags-2.0\src\windows\gflags

D:\ceres\eigen\Eigen

Copy the following files to the Lib folder:

D:\ceres\glog-master\Debug\libglog.lib

D:\ceres\ceres-solver-1.11.0\mybuild\lib\Debug\ceres-debug.lib

D:\ceres\gflags-2.0\Debug\libgflags-debug.lib

D:\ceres\glog-master\Debug\libglog.dll (Copy to C:\Windows\SysWOW64 folder)

Well, all the work is done, and finally just add the C + + directories and linker to the projects that need to be Ceres.

vs2015+64 bit WIN10 System Ceres-solver compilation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.