After compiling and installing madopt with the following instructions:
sudo git clone https://github.com/stanle/madopt.git
cd madopt
mkdir build
cd build
cmake -DCUSTOM_LIBRARY=/usr/local/lib/ -DCUSTOM_INCLUDE=/usr/local/include/ ..
sudo make install
I've tried to compile the get_started.cpp file in the examples folder but it has consistently failed with the same error:
g++ get_started.cpp -g -O2
/usr/bin/ld: /tmp/cceTAgTA.o: in function `main':
/mnt/c/madopt/examples/get_started.cpp:26: undefined reference to `MadOpt::IpoptModel::IpoptModel()'
/usr/bin/ld: /tmp/cceTAgTA.o: in function `void std::_Construct<MadOpt::Var>(MadOpt::Var*)':
/usr/include/c++/9/new:174: undefined reference to `MadOpt::Var::Var()'
/usr/bin/ld: /tmp/cceTAgTA.o: in function `main':
/mnt/c/madopt/examples/get_started.cpp:68: undefined reference to `MadOpt::Model::addVar(double, double, double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: /tmp/cceTAgTA.o: in function `MadOpt::Param::Param()':
/usr/local/include/madopt/param.hpp:28: undefined reference to `MadOpt::Expr::Expr()'
/usr/bin/ld: /tmp/cceTAgTA.o: in function `main':
/mnt/c/madopt/examples/get_started.cpp:81: undefined reference to `MadOpt::Model::addParam(double, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::cos(MadOpt::Expr const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::operator*(double const&, MadOpt::Expr const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::pow(MadOpt::Expr const&, double const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::Expr::operator+(MadOpt::Expr const&) const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::operator-(MadOpt::Expr const&, MadOpt::Expr const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::Expr::operator*(MadOpt::Expr const&) const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::operator-(MadOpt::Expr const&, MadOpt::Expr const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:107: undefined reference to `MadOpt::Model::addEqConstr(MadOpt::Expr const&, double)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:113: undefined reference to `MadOpt::Expr::Expr(int)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:115: undefined reference to `MadOpt::operator-(MadOpt::Expr const&, double const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:115: undefined reference to `MadOpt::pow(MadOpt::Expr const&, double const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:115: undefined reference to `MadOpt::Expr::operator+=(MadOpt::Expr const&&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:118: undefined reference to `MadOpt::Model::setObj(MadOpt::Expr const&)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:123: undefined reference to `MadOpt::IpoptModel::solve()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:128: undefined reference to `MadOpt::Model::hasSolution() const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:131: undefined reference to `MadOpt::Model::objValue() const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:134: undefined reference to `MadOpt::Model::status() const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:137: undefined reference to `MadOpt::Var::x() const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:140: undefined reference to `MadOpt::Constraint::lam() const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:148: undefined reference to `MadOpt::Var::lb(double)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:149: undefined reference to `MadOpt::Var::ub(double)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:150: undefined reference to `MadOpt::Var::init(double)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:152: undefined reference to `MadOpt::Var::lb()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:152: undefined reference to `MadOpt::Var::ub()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:152: undefined reference to `MadOpt::Var::init()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:156: undefined reference to `MadOpt::Constraint::lb(double)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:157: undefined reference to `MadOpt::Constraint::ub(double)'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:159: undefined reference to `MadOpt::Constraint::lb()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:159: undefined reference to `MadOpt::Constraint::ub()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:171: undefined reference to `MadOpt::Model::solAsInit()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:174: undefined reference to `MadOpt::IpoptModel::solve()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:175: undefined reference to `MadOpt::Model::hasSolution() const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:178: undefined reference to `MadOpt::Model::status() const'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:26: undefined reference to `MadOpt::IpoptModel::~IpoptModel()'
/usr/bin/ld: /mnt/c/madopt/examples/get_started.cpp:26: undefined reference to `MadOpt::IpoptModel::~IpoptModel()'
collect2: error: ld returned 1 exit status
A few things I have tried so far are:
All these still lead to the same result. I appreciate any help on this issue.
Thank you.
After compiling and installing madopt with the following instructions:
I've tried to compile the get_started.cpp file in the examples folder but it has consistently failed with the same error:
A few things I have tried so far are:
All these still lead to the same result. I appreciate any help on this issue.
Thank you.