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

Compile error with Visual Studio 2017 when using c++17 or later #577

Closed
MarkBicknellONT opened this issue May 4, 2022 · 0 comments · Fixed by #578
Closed

Compile error with Visual Studio 2017 when using c++17 or later #577

MarkBicknellONT opened this issue May 4, 2022 · 0 comments · Fixed by #578

Comments

@MarkBicknellONT
Copy link
Contributor

MarkBicknellONT commented May 4, 2022

Hello,

If I build master with cmake Visual Studio 15 2017 generator arch x64 on windows 10, the examples build fine.
If I change the C++ language standard to c++17 (or later) in the Visual Studio UI (Configuration Properties -> C/C++ -> Language -> C++ Language Standard) and then try to rebuild, I get the following error:

1>------ Build started: Project: read_write_dataset_string_bin, Configuration: Debug x64 ------
1>read_write_dataset_string.cpp
1>c:\dev\highfive\include\highfive\bits/H5Path_traits_misc.hpp(31): error C2248: 'HighFive::Object::Object': cannot access protected member declared in class 'HighFive::Object'
1>c:\dev\highfive\include\highfive\bits/H5Object_misc.hpp(19): note: see declaration of 'HighFive::Object::Object'
1>c:\dev\highfive\include\highfive\H5Object.hpp(36): note: see declaration of 'HighFive::Object'
1>c:\dev\highfive\include\highfive\bits/H5Path_traits_misc.hpp(19): note: while compiling class template member function 'HighFive::PathTraits<HighFive::DataSet>::PathTraits(void)'
1>c:\dev\highfive\include\highfive\bits\../H5DataSet.hpp(99): note: see reference to function template instantiation 'HighFive::PathTraits<HighFive::DataSet>::PathTraits(void)' being compiled
1>c:\dev\highfive\include\highfive\bits\../H5DataSet.hpp(31): note: see reference to class template instantiation 'HighFive::PathTraits<HighFive::DataSet>' being compiled
1>Done building project "read_write_dataset_string_bin.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It seems that adding PathTraits as a friend class of Object fixes this issue (see linked PR).

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

Successfully merging a pull request may close this issue.

1 participant