test error
lidawenwenwen opened this issue · comments
Wen Li commented
Wen Li commented
/usr/local/include/coin/IpTNLP.hpp:47:28: error: expected initializer before ‘:’ token
47 | class IPOPTLIB_EXPORT TNLP : public ReferencedObject
| ^
In file included from /usr/local/include/coin/IpIpoptApplication.hpp:14,
from /usr/include/cppad/ipopt/solve_callback.hpp:16,
from /usr/include/cppad/ipopt/solve.hpp:405,
from /home/liwen/下载/testCPP-master/cppad_ipopt_demo.cpp:2:
/usr/local/include/coin/IpNLP.hpp:41:26: error: expected initializer before ‘:’ token
41 | class IPOPTLIB_EXPORT NLP: public ReferencedObject
| ^
In file included from /usr/include/cppad/ipopt/solve_callback.hpp:16,
from /usr/include/cppad/ipopt/solve.hpp:405,
from /home/liwen/下载/testCPP-master/cppad_ipopt_demo.cpp:2:
/usr/local/include/coin/IpIpoptApplication.hpp:32:39: error: expected initializer before ‘:’ token
32 | class IPOPTLIB_EXPORT IpoptApplication: public ReferencedObject
| ^
/usr/local/include/coin/IpIpoptApplication.hpp:365:12: error: ‘IPOPTLIB_EXPORT’ does not name a type
365 | extern "C" IPOPTLIB_EXPORT class Ipopt::IpoptApplication* IPOPT_CALLCONV IpoptApplicationFactory();
| ^~~~~~~~~~~~~~~
In file included from /usr/include/cppad/ipopt/solve.hpp:405,
from /home/liwen/下载/testCPP-master/cppad_ipopt_demo.cpp:2:
/usr/include/cppad/ipopt/solve_callback.hpp:43:1: error: expected class-name before ‘{’ token
43 | {
| ^
/usr/include/cppad/ipopt/solve_callback.hpp:53:20: error: ‘TNLP’ in namespace ‘Ipopt’ does not name a type
53 | typedef Ipopt::TNLP::IndexStyleEnum IndexStyleEnum;
| ^~~~
/usr/include/cppad/ipopt/solve_callback.hpp:466:9: error: ‘IndexStyleEnum’ has not been declared
466 | IndexStyleEnum& index_style )
| ^~~~~~~~~~~~~~
/usr/include/cppad/ipopt/solve_callback.hpp: In member function ‘virtual bool CppAD::ipopt::solve_callback<Dvector, ADvector, FG_eval>::get_nlp_info(CppAD::ipopt::solve_callback<Dvector, ADvector, FG_eval>::Index&, CppAD::ipopt::solve_callback<Dvector, ADvector, FG_eval>::Index&, CppAD::ipopt::solve_callback<Dvector, ADvector, FG_eval>::Index&, CppAD::ipopt::solve_callback<Dvector, ADvector, FG_eval>::Index&, int&)’:
/usr/include/cppad/ipopt/solve_callback.hpp:484:23: error: ‘C_STYLE’ was not declared in this scope
484 | index_style = C_STYLE;
| ^~~~~~~
In file included from /home/liwen/下载/testCPP-master/cppad_ipopt_demo.cpp:2:
/usr/include/cppad/ipopt/solve.hpp: In function ‘void CppAD::ipopt::solve(const string&, const Dvector&, const Dvector&, const Dvector&, const Dvector&, const Dvector&, FG_eval&, CppAD::ipopt::solve_result<Dvector>&)’:
/usr/include/cppad/ipopt/solve.hpp:495:18: error: ‘Ipopt::IpoptApplication’ has not been declared
495 | using Ipopt::IpoptApplication;
| ^~~~~~~~~~~~~~~~
/usr/include/cppad/ipopt/solve.hpp:496:21: error: ‘IpoptApplication’ was not declared in this scope
496 | Ipopt::SmartPtr<IpoptApplication> app = new IpoptApplication();
| ^~~~~~~~~~~~~~~~
/usr/include/cppad/ipopt/solve.hpp:496:37: error: template argument 1 is invalid
496 | Ipopt::SmartPtr<IpoptApplication> app = new IpoptApplication();
| ^
/usr/include/cppad/ipopt/solve.hpp:496:49: error: expected type-specifier before ‘IpoptApplication’
496 | Ipopt::SmartPtr<IpoptApplication> app = new IpoptApplication();
| ^~~~~~~~~~~~~~~~
/usr/include/cppad/ipopt/solve.hpp:577:16: error: base operand of ‘->’ is not a pointer
577 | app->Options()->SetStringValue(tok_2.c_str(), tok_3.c_str());
| ^~
/usr/include/cppad/ipopt/solve.hpp:580:16: error: base operand of ‘->’ is not a pointer
580 | app->Options()->SetNumericValue(tok_2.c_str(), value);
| ^~
/usr/include/cppad/ipopt/solve.hpp:584:16: error: base operand of ‘->’ is not a pointer
584 | app->Options()->SetIntegerValue(tok_2.c_str(), value);
| ^~
/usr/include/cppad/ipopt/solve.hpp:609:48: error: base operand of ‘->’ is not a pointer
609 | Ipopt::ApplicationReturnStatus status = app->Initialize();
| ^~
/usr/include/cppad/ipopt/solve.hpp:619:28: error: ‘TNLP’ is not a member of ‘Ipopt’
619 | Ipopt::SmartPtr<Ipopt::TNLP> cppad_nlp =
| ^~~~
/usr/include/cppad/ipopt/solve.hpp:619:28: error: ‘TNLP’ is not a member of ‘Ipopt’
/usr/include/cppad/ipopt/solve.hpp:619:32: error: template argument 1 is invalid
619 | Ipopt::SmartPtr<Ipopt::TNLP> cppad_nlp =
| ^
/usr/include/cppad/ipopt/solve.hpp:637:8: error: base operand of ‘->’ is not a pointer
637 | app->OptimizeTNLP(cppad_nlp);
| ^~
/usr/include/cppad/ipopt/solve.hpp: In instantiation of ‘void CppAD::ipopt::solve(const string&, const Dvector&, const Dvector&, const Dvector&, const Dvector&, const Dvector&, FG_eval&, CppAD::ipopt::solve_result<Dvector>&) [with Dvector = CppAD::vector<double>; FG_eval = {anonymous}::FG_eval; std::string = std::__cxx11::basic_string<char>]’:
/home/liwen/下载/testCPP-master/cppad_ipopt_demo.cpp:78:89: required from here
/usr/include/cppad/ipopt/solve.hpp:619:34: error: invalid conversion from ‘CppAD::ipopt::solve_callback<CppAD::vector<double>, CppAD::vector<CppAD::AD<double> >, {anonymous}::FG_eval>*’ to ‘int’ [-fpermissive]
619 | Ipopt::SmartPtr<Ipopt::TNLP> cppad_nlp =
| ^~~~~~~~~
| |
| CppAD::ipopt::solve_callback<CppAD::vector<double>, CppAD::vector<CppAD::AD<double> >, {anonymous}::FG_eval>*
make[2]: *** [CMakeFiles/cppad_ipopt_demo.dir/build.make:76:CMakeFiles/cppad_ipopt_demo.dir/cppad_ipopt_demo.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:115:CMakeFiles/cppad_ipopt_demo.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
Stefan Vigerske commented
Looks like IPOPTLIB_EXPORT
is not defined. It probably would be fine to have it empty, so add some
#define IPOPTLIB_EXPORT
at the top of /home/liwen/下载/testCPP-master/cppad_ipopt_demo.cpp
.
Also this may be an old Ipopt version. Consider updating.