[Coin-ipopt] problems interfacing ipopt in C

Andreas Waechter andreasw at watson.ibm.com
Thu Oct 19 16:00:26 EDT 2006


Hi Uwe,

You posting was held back because of the long attachments.

> hello,
> 
> i compiled ipopt with cygwin using the introduction paper given with
> the code from coinipopt.org. the make test option worked as well, so i
> assumed that the c interface works in the desired way.
> 
> now i am trying to use the ipopt c library in an matlab c s-function. i
> included it in the template and it seems like compiling is not a
> problem. but the following linking process does not work properly. there
> are some unresolved links to some libraries. all the libraries given in
> the ipopt_addlibs_cpp.txt and ipopt_addlibs_f.txt (which is just m.a)
> are supplied as additional libs in the mex command. i am using visual
> studio c/c++ 7.01 as a compiler. since the make test scenario worked out
> well i thought that the hints given in part D of the manual are not
> important for me. is it possible that i cant use the named compiler from
> vs after i have used the compiler gcc/g++ in cygwin? i added the log
> (log1) from matlab in order to give some insight. i also added the lib
> stdc++ to the mex command and the number of unresolved links decreased
> but instead a double definition occured. this log (log2) is also added.
> hopefully someone can give me some useful hints.
> 
> in addition the libraries named in ipopt_addlibs_cpp.txt and
> ipopt_addlibs_f.txt do not have the same name like in the ipopt
> generated lib. (e.g., g2c.a <-> libg2c.a).
>
> thank you very much
>
> uwe küssel

If I understand correctly, you compiled the Ipopt library under Cygwin, 
using the GNU compiler, but then tried to link everything (using the 
Matlab mex script) with with Microsoft compiler?  Yes, that doesn't work, 
because of different name mangling and probably other bad stuff.

You might be able to use the GNU compilers in your mex script, or you can 
try to use native Windows compilers to compile Ipopt under Cygwin (there 
are some instructions for this in the Ipopt documentation, but you would 
need a Fortran compiler, such as the Intel Fortran compiler...)

I think at some point I was able to use the GCC compilers under Cygwin do 
build a mex file for matlab, and I think I used the software at

gnumex.sourceforge.net

Are you writing a general MEX interface for the C++ verions of Ipopt?

Thanks

Andreas


More information about the Coin-ipopt mailing list