Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unresolved external symbol DynamicCostFunctionToFunctor #1022

Open
alan0526 opened this issue Nov 4, 2023 · 1 comment
Open

unresolved external symbol DynamicCostFunctionToFunctor #1022

alan0526 opened this issue Nov 4, 2023 · 1 comment
Assignees
Milestone

Comments

@alan0526
Copy link

alan0526 commented Nov 4, 2023

OS: Windows
Version: 2.2.0
IDE: Visual Studio 2022
Error Message:

1>calibration.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl ceres::DynamicCostFunctionToFunctor::~DynamicCostFunctionToFunctor(void)" (__imp_??1DynamicCostFunctionToFunctor@ceres@@QEAA@XZ)
1>calibration.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: bool __cdecl ceres::DynamicCostFunctionToFunctor::operator()(double const * const *,double *)const " (__imp_??RDynamicCostFunctionToFunctor@ceres@@QEBA_NPEBQEBNPEAN@Z)
1>calibration.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl ceres::DynamicCostFunctionToFunctor::DynamicCostFunctionToFunctor(class ceres::CostFunction *)" (__imp_??0DynamicCostFunctionToFunctor@ceres@@QEAA@PEAVCostFunction@1@@Z)
1>D:\work\git_atg\ccm\ghj_calibration\ghj_calib\x64\Release\algo_test.exe : fatal error LNK1120: 3 unresolved externals

Screen Shots
DynamicCostFunctionToFunctor is not export
image
Solution2
option 1: remove CERES_EXPORT of the class
option 2: It could be: define the DynamicCostFunctionToFunctor constructor in .cc file

@sergiud sergiud self-assigned this Nov 6, 2023
@Fulva1230
Copy link

As a workaround, add the following code before including the ceres.h header. The CERES_EXPORT of DynamicCostFunctionToFunctor can be removed.

#ifndef CERES_STATIC_DEFINE
  #include "ceres/dynamic_cost_function.h"
  #undef CERES_EXPORT_H
  #define CERES_STATIC_DEFINE
  #include <ceres/dynamic_cost_function_to_functor.h>
  #undef CERES_STATIC_DEFINE
#else
  #include <ceres/ceres.h>
#endif

@sandwichmaker sandwichmaker added this to the 2.3 milestone Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants