Error while compiling the Stan model

Hi All,

I am running the Stan model on my Windows10 system but getting the below error. Request if anybody can help please.

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file53bc59247144.cpp:6:36: warning: ISO C99 requires whitespace after the macro name
#define STAN__SERVICES__COMMAND_HPP#include <boost/integer/integer_log2.hpp>
^
file53bc59247144.cpp:33:40: error: expected template-name before ‘<’ token
: public stan::model::model_base_crtp<model53bc45145c41_m12> {
^
file53bc59247144.cpp:33:40: error: expected ‘{’ before ‘<’ token
file53bc59247144.cpp:33:40: error: expected unqualified-id before ‘<’ token
file53bc59247144.cpp:500:1: error: expected ‘}’ at end of input
}
^
make: *** [C:/PROGRA~1/R/R-3.6.1/etc/x64/Makeconf:215: file53bc59247144.o] Error 1
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command ‘C:/PROGRA~1/R/R-3.6.1/bin/x64/R CMD SHLIB file53bc59247144.cpp 2> file53bc59247144.cpp.err.txt’ had status 1
Error in sink(type = “output”) : invalid connection

Start with

and report if there are continued problems.

Thanks for your response.

I ran file.edit("~/.R/Makevars.win") and got the result as…

CXX11FLAGS=-O3 -march=corei7 -mtune=corei7

There are no clauses of -march=native in CXX14FLAGS. And I also ran file.edit("~/.R/Makevars") but nothing is there, it is a blank file.

The problem still continues.

I am pretty sure the error message is going to be different than the one you posted originally if you have a rstan 2.21.x installed.

Ohh…yes, now after that installation as you suggested, I am getting the error as
Error in file(con, “r”) : invalid ‘description’ argument

traceback() shows as

7: file(con, “r”)
6: readLines(file.path(makevar_files))
5: grep("^CXX.*FLAGS", readLines(file.path(makevar_files)), value = TRUE)
4: .remove_march_makevars()
3: cxxfunctionplus(signature(), body = paste(" return Rcpp::wrap("",
model_name, “”);", sep = “”), includes = inc, plugin = “rstan”,
save_dso = save_dso | auto_write, module_name = paste(“stan_fit4”,
model_cppname, “_mod”, sep = “”), verbose = verbose)
2: stan_model(file, model_name = model_name, model_code = model_code,
stanc_ret = NULL, boost_lib = boost_lib, eigen_lib = eigen_lib,
save_dso = save_dso, verbose = verbose)
1: stan(“m12.stan”, data = dat, iter = 5000)

Try

again

It worked for now. Thanks

Glad it’s working now. Thanks for your patience!