ceres-solver / ceres-solver

A large scale non-linear optimization library

Home Page:http://ceres-solver.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Merely including Ceres header file causes LNK2019 error (unresolved external symbol) from MSVC.

capn-freako opened this issue · comments

Hi,

I'm waiting to be added to the Google group.
So, posting this here in the meantime, hoping this is a known issue.
I'm getting a LNK2019 error from the Microsoft linker when I merely include the Ceres header file.
I don't even need to call any Ceres library functions!
I've put all the details in the following Stack Overflow question:

SO question

Thanks!
-db
:)

Hi @capn-freako, sorry for the delay in approving your membership. Google groups never sent me a notification that your membership is pending. Your membership is now approved.

The error you are reporting is odd because we have a github CI builds on windows which is working okay.
@sergiud any idea what maybe going on here?

also maybe worth asking on the mailinglist.

This seems to be a compiler setup issue. The linker warnings/errors stem from standard library symbols not Ceres.

How did you compile Ceres (or other link libraries for that matter)? Likely your project links against a different runtime library than the one used to compile Ceres. Check your compiler flags.

Different CMake versions might also cause problems because CMake 3.15 changed the way the runtime library is selected.

Finally, you must use CMake (or Bazel) to actually integrate Ceres into your project. Ceres sets different flags and link dependencies which you would need to exactly replicate. Incorrectly replicating compiler flags required by CMake might cause such issues as well.

I think this has been solved by add "/MD".