northwindtraders / beison

A simple json parsing and stringifying library
Other
0 stars 4 forks source link

Compilation on Linux x64 #2

Open theo-dep opened 1 year ago

theo-dep commented 1 year ago

Hi,

I am trying to understand the vcpkg repository example but I am facing this issue when I run vcpkg install in the beson-ptr example:

.../vcpkg/buildtrees/beison/src/b7a414bcb0-d477a732e3.clean/src/beison.cpp: In static member function ‘static beison::Value beison::Value::number(double)’:
.../vcpkg/buildtrees/beison/src/b7a414bcb0-d477a732e3.clean/src/beison.cpp:252:22: error: ‘isfinite’ was not declared in this scope
  252 |                 if (!isfinite(d)) std::abort();
      |                      ^~~~~~~~
.../vcpkg/buildtrees/beison/src/b7a414bcb0-d477a732e3.clean/src/beison.cpp: In member function ‘beison::Value beison::{anonymous}::Parser::parse_number(std::error_code&)’:
.../vcpkg/buildtrees/beison/src/b7a414bcb0-d477a732e3.clean/src/beison.cpp:735:72: error: ‘INFINITY’ was not declared in this scope
  735 |                                                 if (std::abs(result) < INFINITY)
      |                                                                        ^~~~~~~~
ninja: build stopped: subcommand failed.
theo-dep commented 1 year ago

The fix is to include cmath and to replace isfinite by std::isfinite

theo-dep commented 1 year ago

View #3

gblikas commented 4 months ago

@theo-dep I'm having the same issue. Followed the tutorial found here https://learn.microsoft.com/en-us/vcpkg/consume/git-registries. Here is my relevant system information.

$ uname -a

Linux ubuntu-linux-22-04-02-desktop 6.5.0-35-generic #35~22.04.1-Ubuntu x86_64 x86_64 x86_64 GNU/Linux

and the relevant command used with cmake,

cmake -B build -S . \
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_C_COMPILER=$(which gcc) \
-DCMAKE_CXX_COMPILER=$(which g++)

along with the compiler versions,

$ gcc --version

gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version

g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


If this repo has gone stale, the associated tutorial should be removed or modified to show it working. I will open up a proxy issue in https://github.com/microsoft/vcpkg-docs/issues, and hopefully we'll get a PR accepted, or doc change.