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

VC 2016 compile bug? #548

Closed
dellaert opened this issue Oct 1, 2020 · 4 comments
Closed

VC 2016 compile bug? #548

dellaert opened this issue Oct 1, 2020 · 4 comments
Labels
bug Bug report

Comments

@dellaert
Copy link
Member

dellaert commented Oct 1, 2020

Description

It seems VC 2016 fails to complete check after @Alexma3312 ’s PR was merged:


Event.cpp
1114
D:\a\gtsam\gtsam\gtsam/geometry/Point3.h(69): error C2491: 'gtsam::mean': definition of dllimport function not allowed (compiling source file D:\a\gtsam\gtsam\gtsam_unstable\geometry\BearingS2.cpp) [D:\a\gtsam\gtsam\build\gtsam_unstable\gtsam_unstable.vcxproj]
1115
D:\a\gtsam\gtsam\gtsam/geometry/Point3.h(69): error C2491: 'gtsam::mean': definition of dllimport function not allowed (compiling source file D:\a\gtsam\gtsam\gtsam_unstable\geometry\Event.cpp) [D:\a\gtsam\gtsam\build\gtsam_unstable\gtsam_unstable.vcxproj]
1116
  Pose3Upright.cpp
@dellaert dellaert added the bug Bug report label Oct 1, 2020
@Alexma3312
Copy link
Contributor

Alexma3312 commented Oct 1, 2020

I think the reason is the gtsam::mean is defined in the .h file. One fix will be moving the function definition to the .cpp file.
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2491?view=vs-2019

template <class CONTAINER>
GTSAM_EXPORT Point3 mean(const CONTAINER& points) {
  if (points.size() == 0) throw std::invalid_argument("Point3::mean input container is empty");
  Point3 sum(0, 0, 0);
  sum = std::accumulate(points.begin(), points.end(), sum);
  return sum / points.size();
}

@dellaert
Copy link
Member Author

dellaert commented Oct 1, 2020

I think the issue is the name conflict. I am fixing in a branch now...

@ProfFan
Copy link
Collaborator

ProfFan commented Oct 2, 2020

Should this be closed?

@dellaert
Copy link
Member Author

dellaert commented Oct 2, 2020

Fixed in #549

@dellaert dellaert closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report
Projects
None yet
Development

No branches or pull requests

3 participants