Jordan-Scott-Martin / covariance-reaction-norms

Code, tutorial, and data files for estimating covariance reaction norm (CRN) models
GNU General Public License v3.0
3 stars 2 forks source link

An error occured during compilation! #1

Open zhangF23 opened 3 months ago

zhangF23 commented 3 months ago

dear author, i run "meerkat analysis.R" data in meerkat analysis folder, but i encounter some errors during compile model in this code " CRN_mod = cmdstan_model(stan_file = "CRN_tutorial_mod.stan", stanc_options = list("O1")) ". i think this maybe .stan file is not matching my "cmdstan" version , and i do not familiar with stan code. i try to different version "cmdstan" including v2.35.0 and v2.33.0 . Can you tell me your used "cmdstan" version or the other ways to solve this problem. The following is the error message of the "cmdstan v2.33.0" I used: "
Compiling Stan program... Warning in 'C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.stan', line 68, column 13: Found int division: (D (D - 1)) / 2 Values will be rounded towards zero. If rounding is not desired you can write the division as (D (D - 1)) / 2.0 If rounding is intended please use the integer division operator %/%. Error in 'C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.stan', line 63, column 2: Declaration of arrays by placing brackets after a variable name was removed in Stan 2.33.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc Error in 'C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.stan', line 60, column 2: Declaration of arrays by placing brackets after a variable name was removed in Stan 2.33.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc Error in 'C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.stan', line 59, column 2: Declaration of arrays by placing brackets after a variable name was removed in Stan 2.33.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc Error in 'C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.stan', line 53, column 2: Declaration of arrays by placing brackets after a variable name was removed in Stan 2.33.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc Error in 'C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.stan', line 52, column 2: Declaration of arrays by placing brackets after a variable name was removed in Stan 2.33.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc Error in 'C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.stan', line 51, column 2: Declaration of arrays by placing brackets after a variable name was removed in Stan 2.33.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc

mingw32-make: *** [make/program:50: C:/Users/Public/Documents/Wondershare/CreatorTemp/Rtmp0cuT8M/model-2d5868813e0e.hpp] Error 65

错误: An error occured during compilation! See the message above for more information. To fix deprecated or removed syntax please see ?cmdstanr::format for an example. "

Jordan-Scott-Martin commented 3 months ago

Hello @zhangF23,

Thanks for bringing this to my attention. The warning about integer division can be safely ignored. The other series of errors you're receiving are due to the uploading .stan files using older syntax that has been deprecated in the latest version of Stan. I've updated these files now to use current syntax for arrays. Note that these errors can be quickly fixed with cmdstan by running

model = cmdstan_model("....stan", compile = FALSE) 
model$format(canonicalize = TRUE) 

The final error concerning mingw32-make is a more important issue suggesting a failure to compile the model. This is something I can't be of much help with, as it is likely due to unique features of your installation and system. There are many resources online regarding this issue with cmdstan, though, so hopefully you can figure it out smoothly. If this fails to be resolved, you can also try using the rstan package instead of cmdstan, running stan(file = "...stan", ...). See the vignette here for help adopting Stan arguments between these packages.

Please note as well that the meerkat data should be analyzed with the meerkat_CRN_mod.stan file, rather than the the CRN_tutorial_mod.stanfile that is appropriate for data simulated with the accompanying tutorial.

zhangF23 commented 3 months ago

Thank you for your reply, I will try it as soon as possible.

---- Replied Message ---- | From | Jordan S. @.> | | Date | 06/24/2024 20:50 | | To | @.> | | Cc | @.>@.> | | Subject | Re: [Jordan-Scott-Martin/covariance-reaction-norms] An error occured during compilation! (Issue #1) |

Hello @zhangF23,

Thanks for bringing this to my attention. The warning about integer division can be safely ignored. The other series of errors you're receiving are due to the uploading .stan files using older syntax that has been deprecated in the latest version of Stan. I've updated these files now to use current syntax for arrays. Note that these errors can be quickly fixed with cmdstan by running

mod = cmdstan_model("....stan", compile = FALSE) model$format(canonicalize = TRUE)

The final error concerning mingw32-make is a more important issue suggesting a failure to compile the model. This is something I can't be of much help with, as it is likely due to unique features of your installation and system. There are many resources online regarding this issue with cmdstan, though, so hopefully you can figure it out smoothly. If this fails to be resolved, you can also try using the rstan package instead of cmdstan, running stan(file = "...stan", ...). See the vignette here for help adopting Stan arguments between these packages.

Please note as well that the meerkat data should be analyzed with the meerkat_CRN_mod.stan file, rather than the the CRN_tutorial_mod.stan file that is appropriate for data simulated with the accompanying tutorial.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

zhangF23 commented 3 months ago

dear Jordan,

I'm sorry to encounter some problems again during the compilation process in this code "mod = cmdstan_model(stan_file = "meerkat_CRN_mod.stan", stanc_options = list("O1"))" and need your guidance . There is my log file in the attachment. I am really sorry to bother you all the time, but your code is of great help to me. In addition, I still have some questions and I'm looking forward to your guidance. I'm beginning my doctoral studies this year and am interested in gaining knowledge about constructing models for my research. However, my understanding of model building, mathematical theories, and programming languages is still at a beginner level or non-existent. If I want to learn efficiently, I sincerely hope you can provide me with some suggestions, as well as recommend open resources such as access to courses and articles. I am looking forward to your reply.

At 2024-06-24 20:50:49, "Jordan S. Martin" @.***> wrote:

Hello @zhangF23,

Thanks for bringing this to my attention. The warning about integer division can be safely ignored. The other series of errors you're receiving are due to the uploading .stan files using older syntax that has been deprecated in the latest version of Stan. I've updated these files now to use current syntax for arrays. Note that these errors can be quickly fixed with cmdstan by running

mod = cmdstan_model("....stan", compile = FALSE) model$format(canonicalize = TRUE)

The final error concerning mingw32-make is a more important issue suggesting a failure to compile the model. This is something I can't be of much help with, as it is likely due to unique features of your installation and system. There are many resources online regarding this issue with cmdstan, though, so hopefully you can figure it out smoothly. If this fails to be resolved, you can also try using the rstan package instead of cmdstan, running stan(file = "...stan", ...). See the vignette here for help adopting Stan arguments between these packages.

Please note as well that the meerkat data should be analyzed with the meerkat_CRN_mod.stan file, rather than the the CRN_tutorial_mod.stan file that is appropriate for data simulated with the accompanying tutorial.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

mod = cmdstan_model(stan_file = "meerkat_CRN_mod.stan",

  • stanc_options = list("O1")) Compiling Stan program... In file included from stan/lib/stan_math/lib/tbb_2020.3/include/tbb/tbb_profiling.h:123, from stan/lib/stan_math/lib/tbb_2020.3/include/tbb/task.h:36, from stan/lib/stan_math/lib/tbb_2020.3/include/tbb/task_arena.h:23, from stan/lib/stan_math/stan/math/prim/core/init_threadpool_tbb.hpp:18, from stan/lib/stan_math/stan/math/prim/core.hpp:4, from stan/lib/stan_math/stan/math/rev/core/Eigen_NumTraits.hpp:5, from stan/lib/stan_math/stan/math/rev/core/typedefs.hpp:7, from stan/lib/stan_math/stan/math/rev/core/chainable_object.hpp:6, from stan/lib/stan_math/stan/math/rev/core.hpp:10, from stan/lib/stan_math/stan/math/rev.hpp:8, from stan/lib/stan_math/stan/math.hpp:19, from stan/src/stan/model/model_header.hpp:4, from C:/Users/Public/Documents/Wondershare/CreatorTemp/RtmpkftEAM/model-1d7c431e4de5.hpp:2: stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:422:24: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 422 | constexpr atomic(const atomic& rhs): internal::atomic_impl(rhs) {} | ^

stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:422:24: note: remove the '< >' stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:454:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 454 | TBB_DECL_ATOMIC(TBB_LONG_LONG) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:454:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 454 | TBB_DECL_ATOMIC(TBB_LONG_LONG) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:455:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 455 | TBB_DECL_ATOMIC(unsigned TBB_LONG_LONG) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:455:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 455 | TBB_DECL_ATOMIC(unsigned TBB_LONG_LONG) | ^~~~~

stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:459:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 459 | TBB_DECL_ATOMIC(long) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:459:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 459 | TBB_DECL_ATOMIC(long) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:460:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 460 | TBB_DECL_ATOMIC(unsigned long) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:460:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 460 | TBB_DECL_ATOMIC(unsigned long) | ^~~~~

stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:491:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 491 | TBB_DECL_ATOMIC(unsigned) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:491:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 491 | TBB_DECL_ATOMIC(unsigned) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:492:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 492 | TBB_DECL_ATOMIC(int) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:492:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 492 | TBB_DECL_ATOMIC(int) | ^~~~~

stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:495:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 495 | TBB_DECL_ATOMIC(unsigned short) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:495:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 495 | TBB_DECL_ATOMIC(unsigned short) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:496:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 496 | TBB_DECL_ATOMIC(short) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:496:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 496 | TBB_DECL_ATOMIC(short) | ^~~~~

stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:497:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 497 | TBB_DECL_ATOMIC(char) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:497:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 497 | TBB_DECL_ATOMIC(char) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:498:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 498 | TBB_DECL_ATOMIC(signed char) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:498:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 498 | TBB_DECL_ATOMIC(signed char) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:499:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 499 | TBB_DECL_ATOMIC(unsigned char) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:499:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 499 | TBB_DECL_ATOMIC(unsigned char) | ^~~~~

stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor] 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:502:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 502 | TBB_DECL_ATOMIC(wchar_t) | ^~~~~ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:437:32: note: remove the '< >' 437 | constexpr atomic(const atomic& rhs): \ | ^ stan/lib/stan_math/lib/tbb_2020.3/include/tbb/atomic.h:502:1: note: in expansion of macro 'TBB_DECL_ATOMIC' 502 | TBB_DECL_ATOMIC(wchar_t) | ^~~~~

In file included from stan/lib/stan_math/lib/boost_1.78.0/boost/multi_array/multi_array_ref.hpp:32, from stan/lib/stan_math/lib/boost_1.78.0/boost/multi_array.hpp:34, from stan/lib/stan_math/lib/boost_1.78.0/boost/numeric/odeint/algebra/multi_array_algebra.hpp:22, from stan/lib/stan_math/lib/boost_1.78.0/boost/numeric/odeint.hpp:63, from stan/lib/stan_math/stan/math/prim/functor/ode_rk45.hpp:9, from stan/lib/stan_math/stan/math/prim/functor/integrate_ode_rk45.hpp:6, from stan/lib/stan_math/stan/math/prim/functor.hpp:16, from stan/lib/stan_math/stan/math/rev/fun.hpp:200, from stan/lib/stan_math/stan/math/rev.hpp:10: stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:180:45: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 180 | : public boost::functional::detail::unary_function<typename unary_traits::argument_type,bool> | ^~~~~~

In file included from C:/rtools44/ucrt64/include/c++/14.1.0/string:49, from C:/rtools44/ucrt64/include/c++/14.1.0/bits/locale_classes.h:40, from C:/rtools44/ucrt64/include/c++/14.1.0/bits/ios_base.h:41, from C:/rtools44/ucrt64/include/c++/14.1.0/ios:44, from C:/rtools44/ucrt64/include/c++/14.1.0/istream:40, from C:/rtools44/ucrt64/include/c++/14.1.0/sstream:40, from C:/rtools44/ucrt64/include/c++/14.1.0/complex:45, from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Core:50, from stan/lib/stan_math/lib/eigen_3.4.0/Eigen/Dense:1, from stan/lib/stan_math/stan/math/prim/fun/Eigen.hpp:22, from stan/lib/stan_math/stan/math/rev.hpp:4: C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function | ^~~~~~

stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:214:45: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations] 214 | : public boost::functional::detail::binary_function< | ^~~~~~~ C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:131:12: note: declared here 131 | struct binary_function | ^~~~~~~ stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:252:45: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 252 | : public boost::functional::detail::unary_function< | ^~~~~~ C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function | ^~~~~~

stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:299:45: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 299 | : public boost::functional::detail::unary_function< | ^~~~~~ C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function | ^~~~~~ stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:345:57: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 345 | class mem_fun_t : public boost::functional::detail::unary_function<T, S> | ^~~~~~ C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function | ^~~~~~ stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:361:58: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations] 361 | class mem_fun1_t : public boost::functional::detail::binary_function<T, A, S> | ^~~~~~~ C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:131:12: note: declared here 131 | struct binary_function | ^~~~~~~ stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:377:63: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations] 377 | class const_mem_fun_t : public boost::functional::detail::unary_function<const T*, S> | ^~~~~~ C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here 117 | struct unary_function | ^~~


stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:393:64: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
  393 |     class const_mem_fun1_t : public boost::functional::detail::binary_function<const T*, A, S>
      |                                                                ^~~~~~~~~~~~~~~
C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:438:61: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
  438 |     class mem_fun_ref_t : public boost::functional::detail::unary_function<T&, S>
      |                                                             ^~~~~~~~~~~~~~
C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here
  117 |     struct unary_function
      |            ^~~~~~~~~~~~~~

stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:454:62: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
  454 |     class mem_fun1_ref_t : public boost::functional::detail::binary_function<T&, A, S>
      |                                                              ^~~~~~~~~~~~~~~
C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:470:67: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
  470 |     class const_mem_fun_ref_t : public boost::functional::detail::unary_function<const T&, S>
      |                                                                   ^~~~~~~~~~~~~~
C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here
  117 |     struct unary_function
      |            ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:487:68: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
  487 |     class const_mem_fun1_ref_t : public boost::functional::detail::binary_function<const T&, A, S>
      |                                                                    ^~~~~~~~~~~~~~~
C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:533:73: warning: 'template<class _Arg, class _Result> struct std::unary_function' is deprecated [-Wdeprecated-declarations]
  533 |     class pointer_to_unary_function : public boost::functional::detail::unary_function<Arg,Result>
      |                                                                         ^~~~~~~~~~~~~~
C:/rtools
44/ucrt64/include/c++/14.1.0/bits/stl_function.h:117:12: note: declared here
  117 |     struct unary_function
      |            ^~~~~~~~~~~~~~
stan/lib/stan_math/lib/boost_1.78.0/boost/functional.hpp:557:74: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
  557 |     class pointer_to_binary_function : public boost::functional::detail::binary_function<Arg1,Arg2,Result>
      |                                                                          ^~~~~~~~~~~~~~~
C:/rtools44/ucrt64/include/c++/14.1.0/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~

In file included from stan/lib/stan_math/stan/math/prim/prob/normal_ccdf_log.hpp:5,
                 from stan/lib/stan_math/stan/math/prim/prob.hpp:240,
                 from stan/lib/stan_math/stan/math/prim.hpp:16,
                 from stan/lib/stan_math/stan/math/rev.hpp:14:
stan/lib/stan_math/stan/math/prim/prob/normal_lccdf.hpp: In function 'stan::return_type_t<T_x, T_sigma, T_l> stan::math::normal_lccdf(const T_y&, const T_loc&, const T_scale&)':
stan/lib/stan_math/stan/math/prim/prob/normal_lccdf.hpp:68: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
   68 |     } else if (scaled_diff > 8.25 * INV_SQRT_TWO) {

stan/lib/stan_math/stan/math/prim/prob/normal_lccdf.hpp:68: note: adding '-flarge-source-files' will allow for more column-tracking support, at the expense of compilation time and memory

C:/rtools44/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe
: 
src/cmdstan/main.o:main.cpp:(.text$_ZN4stan2io15stan_csv_reader13read_metadataERSiRNS0_17stan_csv_metadataEPSo[_ZN4stan2io15stan_csv_reader13read_metadataERSiRNS0_17stan_csv_metadataEPSo]+0x15d): undefined reference to `std::istream::seekg(std::fpos<int>)'
C:/rtools44/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
src/cmdstan/main.o:main.cpp:(.text$_ZN4stan2io15stan_csv_reader15read_adaptationERSiRNS0_19stan_csv_adaptationEPSo[_ZN4stan2io15stan_csv_reader15read_adaptationERSiRNS0_19stan_csv_adaptationEPSo]+0x24e): undefined reference to `std::istream::seekg(std::fpos<int>)'
C:/rtools44/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
src/cmdstan/main.o:main.cpp:(.text$_ZN4stan2io15stan_csv_reader12read_samplesERSiRN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEERNS0_15stan_csv_timingEPSo[_ZN4stan2io15stan_csv_reader12read_samplesERSiRN5Eigen6MatrixIdLin1ELin1ELi0ELin1ELin1EEERNS0_15stan_csv_timingEPSo]+0x1d8): undefined reference to `std::istream::seekg(std::fpos<int>)'

collect2.exe: error: ld returned 1 exit status

mingw32-make: *** [make/program:59: C:/Users/Public/Documents/Wondershare/CreatorTemp/RtmpkftEAM/model-1d7c431e4de5.exe] Error 1

错误: An error occured during compilation! See the message above for more information.
Jordan-Scott-Martin commented 3 months ago

Hello @zhangF23, it's nice to hear that you're beginning your PhD and trying to learn more about statistical modeling. Unfortunately, I'm leaving for a month of fieldwork tomorrow, so I don't have much time right now to help you debug issues with Stan or provide general resources. However, there are plenty of resources you can find yourself by searching for Stan tutorials online. The covariance reaction norm is a rather advanced modeling approach to take on without some fundamental knowledge in place, so starting here may not be the most efficient way to learn about the basic building blocks of programming and statistics.

Regarding your compilation error, as I mentioned before, the key issue seems to be with mingw32, as indicated by the final output of your model. There often a lot of messages that pop up during compilation, but it is usually only the last few lines where the compilation stops that matter for debugging. Note that in some special cases as well, the model will compile with an error but still run once you try to execute the code again. So it's always good to try twice.

collect2.exe: error: ld returned 1 exit status mingw32-make: *** [make/program:59: C:/Users/Public/Documents/Wondershare/CreatorTemp/RtmpkftEAM/model-1d7c431e4de5.exe] Error 1 If you search terms like "collect2.exe error stan" and "mingw32 make error 1 stan", hopefully you'll find some helpful advice here. As I previously noted, this is an issue with the installation and running of Stan on your hardware, which isn't something I can personally help much with. I would make sure you can go through the basic model running diagnostics of Stan before attempting the specific model proposed here. Check out the RStan Getting Started page for more details.