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

json.hpp:15372:22: error: expected unqualified-id if (not std::isfinite(x)): Started getting this bug after updating my XCode #2056

Closed
sarahaguasvivas opened this issue Apr 20, 2020 · 5 comments
Labels
state: needs more info the author of the issue needs to provide more details

Comments

@sarahaguasvivas
Copy link

sarahaguasvivas commented Apr 20, 2020

[macOS Catalina]

Hi all,

I started getting the following bug after I upgraded my os to OS Catalina and also the version of XCode:

nlohmann_json/single_include/nlohmann/json.hpp:15372:22: error: 
      expected unqualified-id
        if (not std::isfinite(x))
                     ^
/usr/local/include/math.h:155:5: note: expanded from macro 'isfinite'
    ( sizeof(x) == sizeof(float)  ? __inline_isfinitef((float)(x))       \
    ^

I tried: xcode-select --install and also running my cmake file with additional flags. Let me know what I can do to fix this.

@nlohmann
Copy link
Owner

Which other headers did you include?

@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Apr 21, 2020
@sarahaguasvivas
Copy link
Author

sarahaguasvivas commented Apr 21, 2020

Hi,

Here are the headers I have that are not specific to my package are iostream, string, utility , map, vector, sstream. I'm also using another third party software to parse HDF5.

This used to not be a problem until after I updated Xcode.

Cheers

@nlohmann
Copy link
Owner

Can you please check whether the error persists if you include json.hpp first? Quick googling of the error, I found some issues related to including some math header that yield collisions.

@sarahaguasvivas
Copy link
Author

Hi,

Thanks for the quick response. I believe it persists if I include it before the rest. From this Stack Overflow Issue I found that it is possible that my Xcode is corrupted. I will try re-installing it and get back to you as soon as I see the results.

@sarahaguasvivas
Copy link
Author

Hi,

I solved this issue. It was an issue with <cmath>. These were my steps towards solving it. There might be a better way but this worked for me:

  1. Removed /usr/local/include
  2. Installed boost using home-brew
  3. Compiled my package using cmake .. -DBOOST_ROOT="/usr/local/Cellar/boost/1.72.0_1/" -DBOOST_LIBRARYDIR="/usr/local/Cellar/boost/1.72.0_1/" ..

Thanks for the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs more info the author of the issue needs to provide more details
Projects
None yet
Development

No branches or pull requests

2 participants