[Ipopt] Compilation of IPOPT library for C++ example in MSVC(Ipopt.sln)

Antonio Brandao acbrandaoa at live.com
Tue Apr 13 13:18:51 EDT 2010


Hi Chuck,

 

Thanks a lot for the reply. Well, based on your hint I was able to set up a "brute force" procedure (it is indeed very coarse) for new Ipopt projects in MSVS. It goes more or less like that:

 


Within the Ipopt solution (Ipopt.sln) add a New Project creating a Win32 Console Application. Configure it for an Empty Project.
Add two source C++ (.cpp) codes: one for the Problem Representation and another for the Executable (main).
Add one header (.hpp) for the Problem Representation.
Code the two .cpp sources and the .hpp header as described on the Ipopt documentation.
Right click on the project name and choose Project Dependencies from the drop-down menu. The dependencies for the project that must be marked are libCoinBlas, libCoinHSL, libCoinLapack, and libIpopt.
Right click on the project name again and choose Properties.
Under Configuration Properties, click on C/C++ -> General and in Additional Include Directories (on the right panel), paste:
         ..\..\..\..\Ipopt\src\Interfaces;..\..\..\..\Ipopt\src\Common;..\..\..\..\BuildTools\headers;..\..\..\..\Ipopt\src\Algorithm;..\..\..\..\Ipopt\src\LinAlg
 

Under Configuration Properties, click on C/C++ -> Code Generation and in Runtime Library (on the right panel), choose Multi-threaded (/MT).
Under Configuration Properties, click on Linker -> General and in Additional Library Directories (on the right panel), paste "..\libf2c"
Under Configuration Properties, click on Linker -> Input and in Additional Dependencies (on the right panel), paste vcf2c.lib
Build the entire solution and then execute the main as Release.
Actually, I just looked inside the already compiled Ipopt.sln under the hs071_cpp project. I've tested it on yet another test-bed I found on an IBM report by Andreas Wächter and it worked well, I guess.

 

Cheers,

Antonio.


 


Subject: RE: [Ipopt] Compilation of IPOPT library for C++ example in MSVC(Ipopt.sln)
Date: Mon, 12 Apr 2010 12:43:50 -0600
From: cteeter at Suncor.com
To: acbrandaoa at live.com
CC: ipopt at list.coin-or.org




Hi Antonio,
 
 
I noticed the same problem as well, and to fix it, I had to manually add source files (.cpp) to the IPOPT project as needed until the link errors stopped.  These files were included in the IPOPT source distribution, but were not part of the VS solution (.sln) file.  Although I'm not sure how this file was created in the first place, it is easy in Visual Studio to create a separate project (for example, a win32 console app) to represent your model.  Then, you just have to set (the already built) IPOPT.lib as a project dependency which is then linked to your code.  However, your project will still need to reference the IPOPT include files in a manner similar to what's done in the VS solution file that's included with IPOPT.   To resolve any unresolved external link errors, you will then need to make sure that the needed source file(s) is part of your IPOPT library build.  I don't recall having to change any of the include directories to build IPOPT; I just remember having to manually add a few source files.
 
Depending on the location of your new Visual Studio project, you may still need to adjust the relative paths for the include directories so the IPOPT header files can be located at compile time.



From: ipopt-bounces at list.coin-or.org [mailto:ipopt-bounces at list.coin-or.org] On Behalf Of Antonio Brandao
Sent: Saturday, April 10, 2010 9:02 AM
To: ipopt at list.coin-or.org
Subject: [Ipopt] Compilation of IPOPT library for C++ example in MSVC(Ipopt.sln)


Hello,

When I try to exactly reproduce from scratch the example that comes with the IPOPT 3.8.0 installation (the one under the v8 subdiretory that has a pre-processed/pre-compiled solution called Ipopt.sln) in MSVC 8.0, I get lot's of unresolved references errors related to the #Include directive, e.g., the compiler seems not to link IpIpoptApplication.hpp and hs_071_nlp.hpp to the solution. I know this might be a very silly question, but how was the solution Ipopt.sln created for MSVC? Was it created using the MSVC itself or Cywin or other program? In other words, how can I create a new IPOPT problem using MSVC such that I do not have to tell MSVC all the Include File dependencies?

Thanks a lot!

Cheers,
Antonio.




Hotmail: Trusted email with powerful SPAM protection. Sign up now. 
 ------------------------------------------------------------------------
This email and its contents are private and confidential, for the sole use of the addressees. If you are not an intended recipient, copying, forwarding or other distribution of this email or its contents by any means is prohibited. If you believe that you received this email in error please notify the original sender immediately. 

Petro-Canada is a Suncor Energy business.

------------------------

Ce courriel et son contenu sont privés et confidentiels, et sont destinés à l’usage exclusif des destinataires. Si vous n'êtes pas le destinataire prévu, toute reproduction, transfert ou autre forme de diffusion de ce courriel ou de son contenu par quelque moyen que ce soit est interdit. Si vous croyez avoir reçu ce courriel par erreur, veuillez en aviser l'expéditeur original immédiatement. 

Petro-Canada est une entreprise de Suncor Énergie.
 		 	   		  
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/ipopt/attachments/20100413/9fc8dbe8/attachment.html 


More information about the Ipopt mailing list