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 errors with CLang7 & libc++ #158

Closed
abrownsword opened this issue Sep 3, 2018 · 10 comments
Closed

Compile errors with CLang7 & libc++ #158

abrownsword opened this issue Sep 3, 2018 · 10 comments

Comments

@abrownsword
Copy link

I updated to CLI v1.6.1 and started getting errors about the inclusion of <experimental/optional>, telling me should be included instead (this is because the <experimental/optional> header remains in place to generate an error that it shouldn't be used). Examining Optional.hpp it is apparent that when compiling for C++17, both CLI11_STD_OPTIONAL and CLI11_EXPERIMENTAL_OPTIONAL are defined and therefore both and <experimental/optional> are included. Adding a !defined(CLI11_STD_OPTIONAL) to the #if around #define CLI11_EXPERIMENTAL_OPTIONAL fixes this. A similar thing should be done with the boost optional.

@henryiii
Copy link
Collaborator

henryiii commented Sep 3, 2018

You are correct, fixing in coming PR. Are you sure it makes sense to drop boost optional if optional and boost are both available? They shouldn't clash, and a user may still want to use Boost.

@abrownsword
Copy link
Author

I have no opinion on the boost support -- I don't use it and don't have it installed. If you're sure they don't clash then leaving it enabled ought to be fine.

@henryiii
Copy link
Collaborator

henryiii commented Sep 3, 2018

It will only activate if you have Boost. You can always disable it by defining CLI11_BOOST_OPTIONAL as 0. You can also do this before CLI11 1.6.2 comes out with CLI11_EXPERIMENTAL_OPTIONAL, if defined to 0 it will not try to activate even if present.

@henryiii
Copy link
Collaborator

henryiii commented Sep 3, 2018

Please verify this is now fixed in master through #159.

@nyanpasu64
Copy link

nyanpasu64 commented Sep 16, 2018

I'm still getting an error. I think #159 is wrong, it should check !defined(CLI11_STD_OPTIONAL) || CLI11_STD_OPTIONAL == 0.

&& (!defined(CLI11_STD_OPTIONAL) || CLI11_STD_OPTIONAL != 0)

Right now, it includes experimental only if non-experimental already exists!


Changing to CLI11_STD_OPTIONAL == 0 fixes build for me.

@henryiii henryiii reopened this Sep 16, 2018
henryiii added a commit that referenced this issue Sep 16, 2018
@henryiii
Copy link
Collaborator

Check and see if that is better, please! Thanks.

@nyanpasu64
Copy link

nyanpasu64 commented Sep 16, 2018

i can't exactly check, considering I applied the patch directly on the release CLI11.hpp. But this is the same as the working code I have locally (Android Studio NDK r18 Beta 2).

@henryiii
Copy link
Collaborator

Okay, I'll assume for a 1 char fix that's safe enough. :)

@abrownsword
Copy link
Author

Apologies, I haven't had time to sync and test this yet.

@abrownsword
Copy link
Author

I have built from HEAD using Clang 7.0.0 on Linux and it worked perfectly. Thanks.

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

3 participants