#include in stan 2.16

Hi,

While the stan user manual allows #include I wasn’t able to include from cmdstan. Is it not implemented yet?

Linas

What was the problem error message (if there was any)?

Remove all the whitespace (from the line) before the #include.

And everything after the .stan at the end, such as comments. Also, make sure there is no whitespace in the path.

1 Like

Thanks, it fixed.

We’ll be updating the behavior to be more flexible soon. My bad in not supporting the R syntax Ben came up with for RStan the first time.

Yep, I still have problems. I have 4 models and use include. Sometimes
it goes fine but sometimes it dumps all include file and gives error
whitespace end of file. I really want to have in includefile two blocks
that are common for all the modules:
functions {

}
data {

}
but ended up having in main:
functions {
#include fun.stan
}
data {

}
since I was unable to have second include - it said that include file is
not found.

Linas

Are you using CmdStan or one of the other interfaces?

CmdStan. Sorry, I intended to put it on the subject line…