I am trying to recreate the textbook example of using #include from the Stan reference manual https://mc-stan.org/docs/reference-manual/includes.html with my-std-normal.stan being:
functions {
real my_std_normal_lpdf(vector y) {
return -0.5 * y' * y;
}
}
and simple_trial.stan:
#include my-std-normal.stan
parameters {
real y;
}
model {
y ~ my_std_normal();
}
Both files are in the same “Stan/” directory. simple_trial.stan compiles without the #include line, but gives this error when compiling with it:
model ← cmdstan_model(“Stan/simple_trial.stan”, cpp_options = list(stan_threads = TRUE), include_paths = “/data/home/smodi/Documents/ASFMSG-BEMA/Stan”, dir = “/data/home/smodi/Documents/ASFMSG-BEMA/Stan”)
Compiling Stan program… Syntax error in ‘/tmp/RtmpPmPAkh/model-a3725dcfe13f.stan’, line 1, column 0, include error: -------------------------------------------------
1: #include my-std-normal.stan ^
2: parameters {
3: real y; -------------------------------------------------
Could not find include file ‘my-std-normal.stan’ in specified include paths. Current include paths: None
make: *** [/tmp/RtmpPmPAkh/model-a3725dcfe13f.hpp] Error 1
Error: An error occured during compilation! See the message above for more information.
In addition: Warning message:
In readLines(stan_file) :
Error: An error occured during compilation!
See the message above for more information.