cannot compile c++ code using this library

132 katselukertaa
Siirry ensimmäiseen lukemattomaan viestiin

zhch...@colorado.edu

lukematon,
29.6.2017 klo 20.51.3429.6.2017
vastaanottaja BayesOpt discussion
Hi everyone, I am trying to use this library and meet problems!
  I hope to compile the file in bayesopt/examples/bo_branin.
cpp myself(I know they are already compiled in "bin" and I could run bo_branin in bayesopt/bin folder so I believe installed bayesopt library sucessfully). I use the following to compile bo_branin.cpp
   g++ -std=c++11 bo_branin.cpp -o bo_branin
  Then the error shows
   fatal error: testfunctions.hpp: No such file or directory compilation terminated.

  Apparently the testfunction.hpp is in bayesopt folder but it cannot find this file. I could copy this testfunctions.hpp into example folder but then it shows it cannot find "specialtypes.hpp","
fileparser.hpp" so on and so forth.
 Those files are all in bayesopt folder but I believe to copy them into the example folder is not the way to solve it. Even I copy all of those hpp file then compile the bo_branin.cpp. The terminal gives me a bunch of errors like

 bo_branin.cpp:(.text+0x33): undefined reference to `bayesopt::Parameters::
Parameters()'
 bo_branin.cpp:(.text+0x8f): undefined reference to `bayesopt::utils::ParamLoader:
:load(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bayesopt::Parameters&)'

  I believe my way to compile the bo_branin doesn't link to the library at all. Do you know how to solve this problem? Thanks a million!!

Ruben Martinez-Cantin

lukematon,
30.6.2017 klo 10.56.0630.6.2017
vastaanottaja BayesOpt discussion
Please, read the manual from your compiler (gcc) about how to link to
external libraries and manage include paths. Note that BayesOpt uses
C++98, not 11.

Please keep this mailing list to questions about Bayesian optimization
or issues with the code (bugs, compatibility, etc.)

Best,

Ruben
> --
> You received this message because you are subscribed to the Google Groups
> "BayesOpt discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to bayesopt-discus...@googlegroups.com.
> To post to this group, send email to bayesopt-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/bayesopt-discussion.

Kun Kuang

lukematon,
25.10.2017 klo 12.07.0425.10.2017
vastaanottaja BayesOpt discussion
Hi,

Did you solve the problem? I met the same problem, I used an example code (e.g. bo_cont.cpp) to call the project with rewriting the CMake file. But I can not compile and run the example in my computer.

在 2017年6月29日星期四 UTC-7下午5:51:34,zhch...@colorado.edu写道:

Zhaozhong Chen

lukematon,
9.12.2017 klo 17.20.499.12.2017
vastaanottaja BayesOpt discussion
g++ -std=c++11 bo_branin.cpp -o bo_branin -L /usr/local/include/bayesopt/ -l bayesopt -lnlopt -lm 
This is used to compile bayesopt library. -L is used link to to the library and offer its path. -l follows the library's name. -lnlopt -lm for the nlopt.
Also, if you meet things such as " cannot find testfunctions.hpp", these files are all in "include" file. Copy them to where the cpp file is.

Zhaozhong Chen

lukematon,
9.12.2017 klo 17.39.529.12.2017
vastaanottaja BayesOpt discussion
And if you cannot find header file in "include", it should be in "utils"


On Wednesday, October 25, 2017 at 10:07:04 AM UTC-6, Kun Kuang wrote:
Vastaa kaikille
Vastaa kirjoittajalle
Välitä
0 uutta viestiä