rmcantin / bayesopt

BayesOpt: A toolbox for bayesian optimization, experimental design and stochastic bandits.
GNU Affero General Public License v3.0
396 stars 92 forks source link

Build error on Ubuntu 17.04 #18

Closed usptact closed 6 years ago

usptact commented 7 years ago

I cloned the repo, created a "build" directory inside and ran "cmake .." from within that directory. Finally, I attempted to run "make". The compilation seems to be going well till this point:

[ 71%] Building CXX object CMakeFiles/bayesopt.dir/utils/fileparser.cpp.o /home/vlad/tools/bayesopt/utils/fileparser.cpp: In member function ‘bool bayesopt::utils::FileParser::fileExists()’: /home/vlad/tools/bayesopt/utils/fileparser.cpp:88:23: error: cannot convert ‘std::ifstream {aka std::basic_ifstream<char>}’ to ‘bool’ in initialization bool result = ifile; ^~~~~ CMakeFiles/bayesopt.dir/build.make:734: recipe for target 'CMakeFiles/bayesopt.dir/utils/fileparser.cpp.o' failed make[2]: *** [CMakeFiles/bayesopt.dir/utils/fileparser.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/bayesopt.dir/all' failed make[1]: *** [CMakeFiles/bayesopt.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

usptact commented 7 years ago

It turns out that gcc 6.3.0 does not work; The alternative gcc 5.4.1 works just fine. All you need is to install/update alternatives in Ubuntu.

zmiimz commented 6 years ago

imho, it is better to fix the code https://stackoverflow.com/questions/38659115/make-fails-with-error-cannot-convert-stdistream-aka-stdbasic-istreamchar

utils/fileparser.cpp 88 bool result = static_cast<bool>(ifile);

usptact commented 6 years ago

@zmiimz Thanks a lot for pointing this out! I created a merge request #19

rmcantin commented 6 years ago

Thanks. This should be fixed in commit 1326549b68f27801b79984ca227f4183d984107d