[Ipopt-tickets] [Ipopt] #84: Compiler error in ScalableProblems example using MinGW g++ 4.3.0
Ipopt
coin-trac at coin-or.org
Tue Oct 7 15:25:14 EDT 2008
#84: Compiler error in ScalableProblems example using MinGW g++ 4.3.0
------------------------------+---------------------------------------------
Reporter: guest | Owner: ipopt-team
Type: defect | Status: new
Priority: normal | Component: Ipopt
Version: 3.5 (C++ Version) | Severity: normal
Keywords: example |
------------------------------+---------------------------------------------
When trying to build the executable in examples/ScalableProblems, I got
the following error message:
{{{
$ make
g++ -O3 -fomit-frame-pointer -pipe -DNDEBUG -pedantic-errors -Wimplicit
-Wparentheses -Wreturn-type -Wcast-qual -Wall -Wpointer-arith
-Wwrite-strings -Wconversion -Wno-unknown-pragmas -I`echo
/c/GNU/Ipopt-3.5.4/include/coin` -c -o solve_problem.o `test -f
'solve_problem.cpp' || echo './'`solve_problem.cpp
solve_problem.cpp: In function 'int main(int, char**)':
solve_problem.cpp:140: error: 'strcmp' was not declared in this scope
make: *** [solve_problem.o] Error 1
}}}
----
The function 'strcmp' is really a member of cstring/string.h, which is
not explicitly included in 'solve_problem.cpp'. I think that most
compilers implicitly include cstring/string.h when cstdlib/stdlib.h is
included, and therefore this error normally does not show up. However,
to be on the safe side with all compilers, cstring/string.h needs to be
explicitly included.
To successfully compile, I simply added the following code to
'solve_problem.cpp':
{{{
#ifdef HAVE_CSTRING
# include <cstring>
#else
# ifdef HAVE_STRING_H
# include <string.h>
# else
# error "don't have header file for string"
# endif
#endif
}}}
--
Ticket URL: <https://projects.coin-or.org/Ipopt/ticket/84>
Ipopt <http://projects.coin-or.org/Ipopt>
Interior-point optimizer for nonlinear programs.
More information about the Ipopt-tickets
mailing list