[Ipopt] Ipopt include files

Stefan Vigerske stefan at math.hu-berlin.de
Tue Jan 1 15:39:29 EST 2013


I can nail it down to IpVector.hpp. There, a number of functions are 
implemented with inline attribute. Therefor, compiling IpVector.hpp does 
not define any symbols.
However, g++ seems to create references to the functions that are called 
by the implementation, e.g., Ipopt::Vector::AddTwoVectorsImpl.

it is suggested that a possible cause could be that functions have not 
been declared as inline in the class definition. This was indeed not the 
case for IpVector.hpp and at some other places. I think I've fixed this 
now with r2161 in trunk.


On 12/31/2012 01:51 PM, Brad Bell wrote:
> I am attaching a shell script that demonstrates the problem. You will
> need to change the assignment
>      ipopt_prefix="$HOME/prefix/ipopt"
> to the proper prefix for the installation of Ipopt on your system. The
> result I get when I execute the attached script is:
> [bradbell at brad trash]$ ./ipopt_include_question.sh
> g++ ipopt_include_question.cpp -o ipopt_include_question
> -I/home/bradbell/prefix/ipopt/include
> /tmp/ccyZl7BK.o:(.rodata._ZTVN5Ipopt6VectorE[_ZTVN5Ipopt6VectorE]+0xc8):
> undefined reference to `Ipopt::Vector::AddTwoVectorsImpl(double,
> Ipopt::Vector const&, double, Ipopt::Vector const&, double)'
> /tmp/ccyZl7BK.o:(.rodata._ZTVN5Ipopt6VectorE[_ZTVN5Ipopt6VectorE]+0xd0):
> undefined reference to `Ipopt::Vector::FracToBoundImpl(Ipopt::Vector
> const&, double) const'
> /tmp/ccyZl7BK.o:(.rodata._ZTVN5Ipopt6VectorE[_ZTVN5Ipopt6VectorE]+0xd8):
> undefined reference to `Ipopt::Vector::AddVectorQuotientImpl(double,
> Ipopt::Vector const&, Ipopt::Vector const&, double)'
> /tmp/ccyZl7BK.o:(.rodata._ZTVN5Ipopt6VectorE[_ZTVN5Ipopt6VectorE]+0xe0):
> undefined reference to `Ipopt::Vector::HasValidNumbersImpl() const'
> collect2: error: ld returned 1 exit status
> [bradbell at brad trash]$
> On 12/30/2012 07:36 AM, Stefan Vigerske wrote:
>> Hi,
>> On 12/30/2012 02:47 PM, Brad Bell wrote:
>>> I have a template class header file that includes the files
>>>      # include <coin/IpIpoptApplication.hpp>
>>>      # include <coin/IpTNLP.hpp>
>>> I never use the template class, so even though I define it, I do not
>>> expect to need Ipopt to link the corresponding program. The problem is
>>> that it appears that the Ipopt include files listed above are not pure
>>> definitions; i.e., they are actually building code that requires the
>>> Ipopt library to link ?
>> These two header files include a number of other files.
>> Can you be more specific what code they are building? Which symbols do
>> they define?
>> Stefan

More information about the Ipopt mailing list