I get the same error messages when I try to compile the bernoulli model.I've installed stan under Ubuntu with make version 3.81 and g++ version 4.4.3. I don't seem to have any issues with the installation and the translation to C++ seems fine. The error is when I compile.Was there a solution to this issue?
Hi everyone!I am trying to install Stan in the computer cluster of my University. Apparently the installation was done without errors (some warnings). Also the sentencebin/stanc --name=bernoulli --o=bernoulli.cpp src/models/basic_estimators/bernoulli.stanworks without errors. But then something wrong happens:g++ -O3 -Lbin -Isrc -Ilib/boost_1.54.0 -Ilib/eigen_3.2.0 src/models/basic_estimators/bernoulli.cpp -o bernoulli -lstanIn file included from src/stan/model/model_header.hpp:20,from src/models/basic_estimators/bernoulli.cpp:3:src/stan/mcmc/sample.hpp: In function ‘int stan::gm::command(int, const char**) [with Model = bernoulli_model_namespace::bernoulli_model]’:src/models/basic_estimators/bernoulli.cpp:273: instantiated from heresrc/stan/mcmc/sample.hpp:11: error: ‘class stan::mcmc::sample’ is not a function,src/stan/gm/command.hpp:157: error: conflict with ‘template<class Model, class RNG> void stan::gm::sample(stan::mcmc::base_mcmc*, int, int, int, int, bool, stan::io::mcmc_writer<Model>&, stan::mcmc::sample&, Model&, RNG&)’src/stan/gm/command.hpp:887: error: in call to ‘sample’Any help would be welcomeBest regardsAngel
Ubuntu with make version 3.81 and g++ version 4.4.3
Daniel,
Thanks for the reply. It probably is an error on my part, but I get the same errors when I run directly using make. Using the example in make help, I get:
/data/stan# make src/models/basic_distributions/normal
--- Translating Stan model to C++ code ---
bin/stanc src/models/basic_distributions/normal.stan --o=src/models/basic_distributions/normal.cpp
Model name=normal_model
Input file=src/models/basic_distributions/normal.stan
Output file=src/models/basic_distributions/normal.cpp
g++ -I src -isystem lib/eigen_3.2.0 -isystem lib/boost_1.54.0 -Wall -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -c -O3 -o src/models/basic_distributions/normal.o src/models/basic_distributions/normal.cpp
In file included from src/stan/model/model_header.hpp:20,
from src/models/basic_distributions/normal.cpp:3:
src/stan/mcmc/sample.hpp: In function ‘int stan::gm::command(int, const char**) [with Model = normal_model_namespace::normal_model]’:
src/models/basic_distributions/normal.cpp:241: instantiated from here
src/stan/mcmc/sample.hpp:11: error: ‘class stan::mcmc::sample’ is not a function,
src/stan/gm/command.hpp:157: error: conflict with ‘template<class Model, class RNG> void stan::gm::sample(stan::mcmc::base_mcmc*, int, int, int, int, bool, stan::io::mcmc_writer<Model>&, stan::mcmc::sample&, Model&, RNG&)’
src/stan/gm/command.hpp:904: error: in call to ‘sample’
src/stan/math/constants.hpp: At global scope:
src/stan/math/constants.hpp:63: warning: ‘stan::math::NEGATIVE_EPSILON’ defined but not used
src/stan/agrad/rev/var_stack.hpp:49: warning: ‘void stan::agrad::free_memory()’ defined but not used
make: *** [src/models/basic_distributions/normal.o] Error 1
On Thursday, November 7, 2013 11:56:01 AM UTC-5, Daniel Lee wrote:
On Thu, Nov 7, 2013 at 11:07 AM, Jonathan French <jona...@metrumrg.com> wrote:I get the same error messages when I try to compile the bernoulli model.I've installed stan under Ubuntu with make version 3.81 and g++ version 4.4.3. I don't seem to have any issues with the installation and the translation to C++ seems fine. The error is when I compile.Was there a solution to this issue?Yes, the issue is a user error. Bob explained in his email, but I'll give it another try. If you want to be less error prone, try using the makefiles provided. For help, just type 'make' on the command line and it'll show you an example of how to compile the normal model.
I'll assume that bin/stanc has been built. This line translates from a Stan model 'src/models/basic_estimators/bernoulli.stan' and generates a C++ file in './bernoulli.cpp':> bin/stanc --name=bernoulli --o=bernoulli.cpp src/models/basic_estimators/bernoulli.stan
This line is incorrect because it is trying to compile the C++ file in './src/models/basic_estimators/bernoulli.cpp'
> g++ -O3 -Lbin -Isrc -Ilib/boost_1.54.0 -Ilib/eigen_3.2.0 src/models/basic_estimators/bernoulli.cpp -o bernoulli -lstanTo fix it, it should be:
> g++ -O3 -Lbin -Isrc -Ilib/boost_1.54.0 -Ilib/eigen_3.2.0 bernoulli.cpp -o bernoulli -lstan
Hopefully that fixes your problem.