# Compiling error cmdstan example code

**URL:** <https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096>\
**Category:** CmdStan\
**Created:** [October 11, 2022, 8:02am UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096 "2022-10-11T08:02:28Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 11, 2022, 8:02am UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/1 "2022-10-11T08:02:28Z")

</div>

I wanted to run some models making use of `cmdstanr` but I get error messages the whole time. I checked my cdmstan installation etc and tried to compile the example of the website. This generates the following errors:

```nohighlight
> check_cmdstan_toolchain()
The C++ toolchain required for CmdStan is setup properly!
> cmdstan_path()
[1] "/Users/demaeyer/.cmdstanr/cmdstan-2.28.2"
> cmdstan_version()
[1] "2.28.2"
> file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
> mod <- cmdstan_model(file)
Compiling Stan program...
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:34:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/sign.hpp:30:22: error: reference to unresolved using declaration
        return (std::signbit)(x) ? 1 : 0;
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:321:1: note: using declaration annotated with 'using_if_exists' here
using ::signbit _LIBCPP_USING_IF_EXISTS;
^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:155:17: error: reference to unresolved using declaration
   return (std::fpclassify)(t);
                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:322:1: note: using declaration annotated with 'using_if_exists' here
using ::fpclassify _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/le
xical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:314:22: error: reference to unresolved using declaration
        return (std::isfinite)(x);
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:1: note: using declaration annotated with 'using_if_exists' here
using ::isfinite _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:385:22: error: reference to unresolved using declaration
        return (std::isnormal)(x);
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:326:1: note: using declaration annotated with 'using_if_exists' here

using ::isnormal _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:456:22: error: reference to unresolved using declaration
        return (std::isinf)(x);
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:1: note: using declaration annotated with 'using_if_exists' here
using ::isinf _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from 
stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:552:22: error: reference to unresolved using declaration
        return (std::isnan)(x);
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:1: note: using declaration annotated with 'using_if_exists' here
using ::isnan _LIBCPP_USING_IF_EXISTS;
^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:8:
In file included from src/cmdstan/arguments/arg_num_threads.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/err/invalid_argument.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/meta.hpp:176:
In file included from stan/lib/stan_math/stan/math/prim/meta/append_return_type.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:723:12: error: reference to unresolved using declaration
    return isfinite EIGEN_NOT_A_MACRO (x);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:1: note: using declaration annotated with 'using_if_exists' here
using ::isfinite _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:8:
In file included from src/cmdstan/arguments/arg_num_threads.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/err/invalid_argument.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/meta.hpp:176:
In file included from stan/lib/stan_math/stan/math/prim/meta/append_return_type.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:738:12: error: reference to unresolved using declaration
    return isinf EIGEN_NOT_A_MACRO (x);
     
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:1: note: using declaration annotated with 'using_if_exists' here
using ::isinf _LIBCPP_USING_IF_EXISTS;
^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:8:
In file included from src/cmdstan/arguments/arg_num_threads.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/err/invalid_argument.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/meta.hpp:176:
In file included from stan/lib/stan_math/stan/math/prim/meta/append_return_type.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:753:12: error: reference to unresolved using declaration
    return isnan EIGEN_NOT_A_MACRO (x);
           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:1: note: using declaration annotated with 'using_if_exists' here
using ::isnan _LIBCPP_USING_IF_EXISTS;
^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:8:
In file included from stan/lib/stan_math/stan/math/prim/fun/is_any_nan.hpp:4:
stan/lib/stan_math/stan/math/prim/fun/is_nan.hpp:20:15: error: expected unqualified-id
  return std::isnan(x);
              ^
/usr/local/include/math.h:165:5: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
    ^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:10:
In file included from stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:5:
stan/lib/stan_math/stan/math/prim/fun/is_inf.hpp:18:44: error: expected unqualified-id
inline bool is_inf(double x) { return std::isinf(x); }
                                           ^
/usr/local/include/math.h:160:5: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
    ^
In file included from src/cmdstan/main.cpp:1:
In file included from 
src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:10:
stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:23:13: error: expected unqualified-id
inline bool isinf(const T& v) {
            ^
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:10:
stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:23:13: error: expected ')'
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:23:13: note: to match this '('
/usr/local/include/math.h:160:5: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
    ^
In file included from src/cmdstan/main.cpp:1:
In file 
included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:11:
stan/lib/stan_math/stan/math/prim/fun/isnan.hpp:21:13: error: expected unqualified-id
inline bool isnan(const T& x) {
            ^
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'

    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:11:
stan/lib/stan_math/stan/math/prim/fun/isnan.hpp:21:13: error: expected ')'
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
stan/lib/stan_math/stan/math/prim/fun/isnan.hpp:21:13: note: to match this '('
/usr/local/include/math.h:165:5: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
    ^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:62:
stan/lib/stan_math/stan/math/rev/core/std_isinf.hpp:16:13: error: expected unqualified-id
inline bool isinf(const stan::math::var& a) {
            ^
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:62:
stan/lib/stan_math/stan/math/rev/core/std_isinf.hpp:16:13: error: expected ')'
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
stan/lib/stan_math/stan/math/rev/core/std_isinf.hpp:16:13: note: to match this '('
/usr/local/include/math.h:160:5: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
    ^

In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:63:
stan/lib/stan_math/stan/math/rev/core/std_isnan.hpp:18:13: error: expected unqualified-id
inline bool isnan(const stan::math::var& a) { return isnan(a.val()); }
            ^
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:63:
stan/lib/stan_math/stan/math/rev/core/std_isnan.hpp:18:13: error: expected ')'
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
stan/lib/stan_math/stan/math/rev/core/std_isnan.hpp:18:13: note: to match this '('
/usr/local/include/math.h:165:5: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
    ^

fatal error: too many errors emitted, stopping now [-ferror-limit=]

20 errors generated.

make: *** [src/cmdstan/main.o] Error 1

Error: An error occured during compilation! See the message above for more information.

```

I’m really not so familiar with all what is going on in the background (like Xcode stuff and so on) but it used to work in the past (before updating to MacOS Monterey I guess.

- Operating System: MacOS Monterey

Can anyone help?

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 11, 2022, 9:30am UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/2 "2022-10-11T09:30:32Z")

</div>

Can you try changing your system to used the Commandline Tools? Open a terminal and run:

```nohighlight
sudo xcode-select -s /Library/Developer/CommandLineTools

```

Then in R, run:

```r
cmdstanr::rebuild_cmdstan()

```

---

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 11, 2022, 10:07am UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/3 "2022-10-11T10:07:06Z")

</div>

Tried that but I get a lot of errors when running the `rebuild_cmdstan()`

Error (I only copied a part):

```nohighlight
                                                       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:643:18: error: no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:643:50: error: no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
                                                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:648:17: error: no template named 'numeric_limits'
  static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:651:25: error: no template named 'numeric_limits'
  return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:651:58: error: no template named 'numeric_limits'
  return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
                                                         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:661:16: error: no template named 'numeric_limits'
  using _Lim = numeric_limits<_IntT>;
               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:664:12: error: use of undeclared identifier '_Lim'
    return _Lim::max();
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:665:21: error: use of undeclared identifier '_Lim'
  } else if (__r <= _Lim::lowest()) {
                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:666:12: error: use of undeclared identifier '_Lim'
    return _Lim::min();
           ^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:723:12: error: reference to unresolved using declaration
    return isfinite EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:1: note: using declaration annotated with 'using_if_exists' here
using ::isfinite _LIBCPP_USING_IF_EXISTS;
^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:738:12: error: reference to unresolved using declaration
    return isinf EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:1: note: using declaration annotated with 'using_if_exists' here
using ::isinf _LIBCPP_USING_IF_EXISTS;
^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:753:12: error: reference to unresolved using declaration
    return isnan EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:1: note: using declaration annotated with 'using_if_exists' here
using ::isnan _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:34:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/sign.hpp:30:22: error: reference to unresolved using declaration
        return (std::signbit)(x) ? 1 : 0;
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:321:1: note: using declaration annotated with 'using_if_exists' here
using ::signbit _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:155:17: error: reference to unresolved using declaration
   return (std::fpclassify)(t);
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:322:1: note: using declaration annotated with 'using_if_exists' here
using ::fpclassify _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:314:22: error: reference to unresolved using declaration
        return (std::isfinite)(x);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:1: note: using declaration annotated with 'using_if_exists' here
using ::isfinite _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:385:22: error: reference to unresolved using declaration
        return (std::isnormal)(x);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:326:1: note: using declaration annotated with 'using_if_exists' here
using ::isnormal _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:456:22: error: reference to unresolved using declaration
        return (std::isinf)(x);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:1: note: using declaration annotated with 'using_if_exists' here
using ::isinf _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:4:
In file included from src/cmdstan/arguments/arg_data.hpp:4:
In file included from src/cmdstan/arguments/categorical_argument.hpp:4:
In file included from src/cmdstan/arguments/argument.hpp:4:
In file included from stan/src/stan/callbacks/writer.hpp:4:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:552:22: error: reference to unresolved using declaration
        return (std::isnan)(x);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:1: note: using declaration annotated with 'using_if_exists' here
using ::isnan _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:8:
In file included from src/cmdstan/arguments/arg_num_threads.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/err/invalid_argument.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/meta.hpp:176:
In file included from stan/lib/stan_math/stan/math/prim/meta/append_return_type.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:723:12: error: reference to unresolved using declaration
    return isfinite EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:1: note: using declaration annotated with 'using_if_exists' here
using ::isfinite _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:8:
In file included from src/cmdstan/arguments/arg_num_threads.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/err/invalid_argument.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/meta.hpp:176:
In file included from stan/lib/stan_math/stan/math/prim/meta/append_return_type.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:738:12: error: reference to unresolved using declaration
    return isinf EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:1: note: using declaration annotated with 'using_if_exists' here
using ::isinf _LIBCPP_USING_IF_EXISTS;
^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:8:
In file included from src/cmdstan/arguments/arg_num_threads.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/err/invalid_argument.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/meta.hpp:176:
In file included from stan/lib/stan_math/stan/math/prim/meta/append_return_type.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Dense:1:
In file included from stan/lib/stan_math/lib/eigen_3.3.9/Eigen/Core:374:
stan/lib/stan_math/lib/eigen_3.3.9/Eigen/src/Core/MathFunctions.h:753:12: error: reference to unresolved using declaration
    return isnan EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:1: note: using declaration annotated with 'using_if_exists' here
using ::isnan _LIBCPP_USING_IF_EXISTS;
^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:6:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:34:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/sign.hpp:30:22: error: reference to unresolved using declaration
        return (std::signbit)(x) ? 1 : 0;
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:321:1: note: using declaration annotated with 'using_if_exists' here
using ::signbit _LIBCPP_USING_IF_EXISTS;
^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:6:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:155:17: error: reference to unresolved using declaration
   return (std::fpclassify)(t);
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:322:1: note: using declaration annotated with 'using_if_exists' here
using ::fpclassify _LIBCPP_USING_IF_EXISTS;
^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:6:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:314:22: error: reference to unresolved using declaration
        return (std::isfinite)(x);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:1: note: using declaration annotated with 'using_if_exists' here
using ::isfinite _LIBCPP_USING_IF_EXISTS;
^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:6:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:385:22: error: reference to unresolved using declaration
        return (std::isnormal)(x);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:326:1: note: using declaration annotated with 'using_if_exists' here
using ::isnormal _LIBCPP_USING_IF_EXISTS;
^
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:19:
In file included from stan/lib/stan_math/stan/math/rev.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:10:
In file included from stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6:
In file included from stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7:
In file included from stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5:
In file included from stan/lib/stan_math/stan/math/prim/core.hpp:4:
In file included from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:6:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast.hpp:32:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/try_lexical_convert.hpp:44:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical.hpp:54:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/converter_lexical_streams.hpp:63:
In file included from stan/lib/stan_math/lib/boost_1.75.0/boost/lexical_cast/detail/inf_nan.hpp:35:
stan/lib/stan_math/lib/boost_1.75.0/boost/math/special_functions/fpclassify.hpp:456:22: error: reference to unresolved using declaration
        return (std::isinf)(x);
                     ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:1: note: using declaration annotated with 'using_if_exists' here
using ::isinf _LIBCPP_USING_IF_EXISTS;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:8:
In file included from stan/lib/stan_math/stan/math/prim/fun/is_any_nan.hpp:4:
stan/lib/stan_math/stan/math/prim/fun/is_nan.hpp:20:15: error: expected unqualified-id
  return std::isnan(x);
              ^
/usr/local/include/math.h:165:5: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
    ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:10:
In file included from stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:5:
stan/lib/stan_math/stan/math/prim/fun/is_inf.hpp:18:44: error: expected unqualified-id
inline bool is_inf(double x) { return std::isinf(x); }
                                           ^
/usr/local/include/math.h:160:5: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
    ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:10:
stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:23:13: error: expected unqualified-id
inline bool isinf(const T& v) {
            ^
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:10:
stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:23:13: error: expected ')'
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
stan/lib/stan_math/stan/math/prim/fun/isinf.hpp:23:13: note: to match this '('
/usr/local/include/math.h:160:5: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
    ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:11:
stan/lib/stan_math/stan/math/prim/fun/isnan.hpp:21:13: error: expected unqualified-id
inline bool isnan(const T& x) {
            ^
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:29:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_divide_equal.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:13:
In file included from stan/lib/stan_math/stan/math/rev/core/operator_multiplication.hpp:11:
stan/lib/stan_math/stan/math/prim/fun/isnan.hpp:21:13: error: expected ')'
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
stan/lib/stan_math/stan/math/prim/fun/isnan.hpp:21:13: note: to match this '('
/usr/local/include/math.h:165:5: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
    ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:62:
stan/lib/stan_math/stan/math/rev/core/std_isinf.hpp:16:13: error: expected unqualified-id
inline bool isinf(const stan::math::var& a) {
            ^
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:62:
stan/lib/stan_math/stan/math/rev/core/std_isinf.hpp:16:13: error: expected ')'
/usr/local/include/math.h:160:7: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
      ^
stan/lib/stan_math/stan/math/rev/core/std_isinf.hpp:16:13: note: to match this '('
/usr/local/include/math.h:160:5: note: expanded from macro 'isinf'
    ( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
    ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:63:
stan/lib/stan_math/stan/math/rev/core/std_isnan.hpp:18:13: error: expected unqualified-id
inline bool isnan(const stan::math::var& a) { return isnan(a.val()); }
            ^
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
In file included from src/cmdstan/main.cpp:1:
In file included from src/cmdstan/command.hpp:21:
In file included from src/cmdstan/write_profiling.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/core/profiling.hpp:8:
In file included from stan/lib/stan_math/stan/math/rev/fun/value_of.hpp:5:
In file included from stan/lib/stan_math/stan/math/rev/core.hpp:63:
stan/lib/stan_math/stan/math/rev/core/std_isnan.hpp:18:13: error: expected ')'
/usr/local/include/math.h:165:7: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
      ^
stan/lib/stan_math/stan/math/rev/core/std_isnan.hpp:18:13: note: to match this '('
/usr/local/include/math.h:165:5: note: expanded from macro 'isnan'
    ( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [stan/src/stan/model/model_header.hpp.gch] Error 1
make: *** Waiting for unfinished jobs....
20 errors generated.
make: *** [src/cmdstan/main.o] Error 1

```

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 11, 2022, 1:27pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/4 "2022-10-11T13:27:47Z")

</div>

Next I’ll need to see the compiler being called and its flags, can you post the output from the following:

```r
system("touch foo.cpp && R CMD SHLIB foo.cpp")

```

If you could also post the output from the very start of the `rebuild_cmdstan()` call which shows the compiler and flags and there as well

---

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 11, 2022, 1:42pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/5 "2022-10-11T13:42:31Z")

</div>

This is what I get:

```nohighlight
> system("touch foo.cpp && R CMD SHLIB foo.cpp")
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/unsupported" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/BH/include" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/src/" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppParallel/include/" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp' -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 -I/usr/local/include -fPIC -Wall -g -O2 -c foo.cpp -o foo.o
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:96:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/complex:235:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:642:26: error: no template named 'numeric_limits'
    bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
                         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:642:60: error: no template named 'numeric_limits'
    bool _FloatBigger = (numeric_limits<_FloatT>::digits > numeric_limits<_IntT>::digits),
                                                           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:643:18: error: no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:643:50: error: no template named 'numeric_limits'
    int _Bits = (numeric_limits<_IntT>::digits - numeric_limits<_FloatT>::digits)>
                                                 ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:648:17: error: no template named 'numeric_limits'
  static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect radix");
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:651:25: error: no template named 'numeric_limits'
  return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:651:58: error: no template named 'numeric_limits'
  return _FloatBigger ? numeric_limits<_IntT>::max() : (numeric_limits<_IntT>::max() >> _Bits << _Bits);
                                                         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:645:25: error: no return statement in constexpr function
_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:661:16: error: no template named 'numeric_limits'
  using _Lim = numeric_limits<_IntT>;
               ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:664:12: error: use of undeclared identifier '_Lim'
    return _Lim::max();
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:665:21: error: use of undeclared identifier '_Lim'
  } else if (__r <= _Lim::lowest()) {
                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:666:12: error: use of undeclared identifier '_Lim'
    return _Lim::min();
           ^
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:374:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/MathFunctions.h:723:12: error: reference to unresolved using declaration
    return isfinite EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:1: note: using declaration annotated with 'using_if_exists' here
using ::isfinite _LIBCPP_USING_IF_EXISTS;
^
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:374:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/MathFunctions.h:738:12: error: reference to unresolved using declaration
    return isinf EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:1: note: using declaration annotated with 'using_if_exists' here
using ::isinf _LIBCPP_USING_IF_EXISTS;
^
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:374:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/MathFunctions.h:753:12: error: reference to unresolved using declaration
    return isnan EIGEN_NOT_A_MACRO (x);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:1: note: using declaration annotated with 'using_if_exists' here
using ::isnan _LIBCPP_USING_IF_EXISTS;
^
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:441:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/MatrixBase.h:130:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/eigen_plugins.h:22:30: error: no template named 'conditional_t' in namespace 'std'; did you mean 'conditional'?
using double_return_t = std::conditional_t<std::is_const<std::remove_reference_t<T>>::value,
                        ~~~~~^~~~~~~~~~~~~
                             conditional
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:538:33: note: 'conditional' declared here
    struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
                                ^
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:441:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/MatrixBase.h:130:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/eigen_plugins.h:22:63: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
using double_return_t = std::conditional_t<std::is_const<std::remove_reference_t<T>>::value,
                                                         ~~~~~^~~~~~~~~~~~~~~~~~
                                                              remove_reference
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:1334:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
                                                 ^
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:441:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/MatrixBase.h:130:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/eigen_plugins.h:26:31: error: no template named 'conditional_t' in namespace 'std'; did you mean 'conditional'?
using reverse_return_t = std::conditional_t<std::is_const<std::remove_reference_t<T>>::value,
                         ~~~~~^~~~~~~~~~~~~
                              conditional
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:538:33: note: 'conditional' declared here
    struct _LIBCPP_TEMPLATE_VIS conditional {typedef _If type;};
                                ^
In file included from <built-in>:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/Core:441:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppEigen/include/Eigen/src/Core/MatrixBase.h:130:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StanHeaders/include/stan/math/prim/mat/eigen_plugins.h:26:64: error: no template named 'remove_reference_t' in namespace 'std'; did you mean 'remove_reference'?
using reverse_return_t = std::conditional_t<std::is_const<std::remove_reference_t<T>>::value,
                                                          ~~~~~^~~~~~~~~~~~~~~~~~
                                                               remove_reference
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:1334:50: note: 'remove_reference' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG_TYPE _Tp type;};
                                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [foo.o] Error 1

```

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 11, 2022, 1:49pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/6 "2022-10-11T13:49:02Z")

</div>

It looks like you have `rstan` loaded, can you close and re-open R (making sure that no packages and objects get loaded) and then run:

```r
system("rm foo.o && touch foo.cpp && R CMD SHLIB foo.cpp")

```

To see the flags again?

---

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 11, 2022, 2:04pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/7 "2022-10-11T14:04:12Z")

</div>

Hi  
Now I get this:

```nohighlight
Restarting R session...

> system("rm foo.o && touch foo.cpp && R CMD SHLIB foo.cpp")
rm: foo.o: No such file or directory

```

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 11, 2022, 2:24pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/8 "2022-10-11T14:24:02Z")

</div>

That’s fine, just remove the `rm foo.o &&` from the command and run again

---

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 11, 2022, 2:27pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/9 "2022-10-11T14:27:42Z")

</div>

This is the result:

```nohighlight
> system("touch foo.cpp && R CMD SHLIB foo.cpp")
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -fPIC -Wall -g -O2 -c foo.cpp -o foo.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation

```

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 11, 2022, 2:29pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/10 "2022-10-11T14:29:34Z")

</div>

Looks like it worked, can you try the `rebuild_cmdstan()` call now?

---

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 11, 2022, 2:38pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/11 "2022-10-11T14:38:44Z")

</div>

Errors again… And the annoying thing is that it doesn’t print everything in the Console (the top part is chopped away).

---

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 11, 2022, 2:48pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/12 "2022-10-11T14:48:28Z")

</div>

[output.txt](https://discourse.mc-stan.org/uploads/short-url/wKVtC6ciniFo4EIipdOTQZZCbOH.txt) (7.0 MB)  
Attached the output of the `rebuild_cmdstan()`call.

---

<div class="post-metadata">

**Author:** ![Sven\_De\_Maeyer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/sven_de_maeyer/32/10872_2.png) [@Sven\_De\_Maeyer](https://discourse.mc-stan.org/u/Sven_De_Maeyer)\
**Post date:** [October 19, 2022, 1:38pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/13 "2022-10-19T13:38:21Z")

</div>

I found the solution in another corner than the stan-related fora. Seems I had a more general problem with compiling. Could not install packages from source neither in R.

Solution was to delete `/usr/local/include` from my system (a folder created when using brew).

A link to the threat that solved it for me:

> <https://github.com/RcppCore/Rcpp/issues/1160#issuecomment-834849802>
>
> Rcpp gives many compilation errors on new MacOS Big Sur 11.3.1 and Xcode 12.5.
> …
> \`\`\`
> \#~/Desktop/hello.cpp
> \#include \<Rcpp.h\>
> // \[\[Rcpp::export\]\]
> void hello()
> {
> Rprintf("Hello, world!\\n");
> }
> \`\`\`
> 
> \`\`\`
> \> library(Rcpp)
> \> sourceCpp("~/Desktop/hello.cpp")
> In file included from hello.cpp:1:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:321:9: error: no member named 'signbit' in the global namespace
> using ::signbit;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:322:9: error: no member named 'fpclassify' in the global namespace
> using ::fpclassify;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:323:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
> using ::isfinite;
> ~~^
> /usr/local/include/math.h:752:12: note: 'finite' declared here
> extern int finite(double)
> ^
> In file included from hello.cpp:1:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:324:9: error: no member named 'isinf' in the global namespace
> using ::isinf;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:325:9: error: no member named 'isnan' in the global namespace
> using ::isnan;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:326:9: error: no member named 'isnormal' in the global namespace
> using ::isnormal;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:327:9: error: no member named 'isgreater' in the global namespace
> using ::isgreater;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:328:9: error: no member named 'isgreaterequal' in the global namespace
> using ::isgreaterequal;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:329:9: error: no member named 'isless' in the global namespace
> using ::isless;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:330:9: error: no member named 'islessequal' in the global namespace
> using ::islessequal;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:331:9: error: no member named 'islessgreater' in the global namespace
> using ::islessgreater;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:332:9: error: no member named 'isunordered' in the global namespace
> using ::isunordered;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:333:9: error: no member named 'isunordered' in the global namespace
> using ::isunordered;
> ~~^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:339:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
> using ::abs;
> ~~^
> /usr/local/include/math.h:417:15: note: 'fabs' declared here
> extern double fabs(double);
> ^
> In file included from hello.cpp:1:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:27:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/RcppCommon.h:29:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/r/headers.h:67:
> In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100:
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:644:26: error: no template named 'numeric\_limits'
> bool \_FloatBigger = (numeric\_limits\<\_FloatT\>::digits \> numeric\_limits\<\_IntT\>::digits),
> ^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:644:60: error: no template named 'numeric\_limits'
> bool \_FloatBigger = (numeric\_limits\<\_FloatT\>::digits \> numeric\_limits\<\_IntT\>::digits),
> ^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:645:18: error: no template named 'numeric\_limits'
> int \_Bits = (numeric\_limits\<\_IntT\>::digits - numeric\_limits\<\_FloatT\>::digits)\>
> ^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:645:50: error: no template named 'numeric\_limits'
> int \_Bits = (numeric\_limits\<\_IntT\>::digits - numeric\_limits\<\_FloatT\>::digits)\>
> ^
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:650:17: error: no template named 'numeric\_limits'
> static\_assert(numeric\_limits\<\_FloatT\>::radix == 2, "FloatT has incorrect radix");
> ^
> fatal error: too many errors emitted, stopping now \[-ferror-limit=\]
> 20 errors generated.
> make: \*\*\* \[hello.o\] Error 1
> clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include" -I"/Users/evrong01/Desktop" -I/usr/local/include -fPIC -Wall -g -O2 -c hello.cpp -o hello.o
> Error in sourceCpp("~/Desktop/hello.cpp") : 
> Error 1 occurred building shared library.
> \`\`\`
> 
> Uninstalling and re-installing Xcode does not fix the problem. Every other possible way of installing and reinstalling xcode command line tools does not help.

It was a local issue, so I’ll close the discussion.  
@andrjohns : THX for trying to help me. Much appreciated!

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [October 19, 2022, 2:26pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/14 "2022-10-19T14:26:11Z")

</div>

Great to hear that you found the solution and thanks for sharing it here! It’s great to have a solution that I can point people to in the future

---

<div class="post-metadata">

**Author:** ![mlqr28](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@mlqr28](https://discourse.mc-stan.org/u/mlqr28)\
**Post date:** [November 10, 2023, 6:30pm UTC](https://discourse.mc-stan.org/t/compiling-error-cmdstan-example-code/29096/15 "2023-11-10T18:30:08Z")

</div>

Hi Sven. I have the same problem now.
