[Ipopt] Trying to run IPOPT C++ example

Alexander Martinez-Marchese alex.martinezmarchese at outlook.com
Wed Aug 23 22:26:07 EDT 2017


      I'm trying to run the C++ example described here:


So I copied the files myexample.cpp, hs071_nlp.cpp and hs071_nlp.cpp and I run the following in the terminal (within Ubuntu linux):

c++ -std=c++11 myexample.cpp hs071_nlp.cpp -o myexample -I /home/alex/Ipopt-3.12.8/include/coin

And I get the following error:

/tmp/ccIUQtXB.o: In function `main':
myexample.cpp:(.text+0x52): undefined reference to `IpoptApplicationFactory'
collect2: error: ld returned 1 exit status

I tested my IPOPT installation using 'make test' and I get this:

Running unitTests...
Testing AMPL Solver Executable...
    no AMPL solver executable found, skipping test...
Testing C++ Example...
    Test passed!
Testing C Example...
    Test passed!
Testing Fortran Example...
    Test passed!
make[2]: Leaving directory '/home/alex/Ipopt-3.12.8/Ipopt/test'
make[1]: Leaving directory '/home/alex/Ipopt-3.12.8/Ipopt'

Do I need AMPL for the example? Am I linking the files correctly? Is there a 'bare bones' C++ example that doesn't use smart pointers or the IpoptApplicationFactory?

I am able to use IPOPT from pyipopt to solve l-bfgs-b problems. The IPOPT installation was installed with the HSL files: http://www.hsl.rl.ac.uk/ipopt/

Thank you,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/ipopt/attachments/20170824/1e88b326/attachment.html>

More information about the Ipopt mailing list