[Symphony] Symphony on C++ with Eclipse

Ted Ralphs ted at lehigh.edu
Sun Dec 2 18:52:07 EST 2012


Hi Hugh,

The problem is that you need to link more than just the SYMPHONY library.
There is a separate library for the OSI interface, as well as libraries for
a number of other dependent COIN projects. However, since you are in Linux,
the fix is easy. The most straightforward way to build your own application
is to just modify one of the files in the <prefix>/SYMPHONY/Examples
directory. There is a Makefile there that will build an executable from any
source file you provide. For example, simply typing "make milp" will build
the main function in milp.c and link it to SYMPHONY. If you put
MySource.cpp in the Examples directory and type "make MySource", it should
build properly. Note, however, that if you are going to use the OSI
interface, you will need to set "USE_OSI_INTERFACE" to TRUE.

To give a little more detail in case you want to build you own makefile,
you can use the automatically generated Makefile in
<prefix>/SYMPHONY/Examples as a template. You will notice that the command
line for linking gets the list of libraries using the "pkg-config" command.
You can get the list of libraries explicitly using this command if you
like. For example, here is the command to get the list of libraries that
must be added when linking:

PKG_CONFIG_PATH=<prefix>/lib/pkgconfig pkg-config --libs symphony

You can also get a list of additional flags for building:

PKG_CONFIG_PATH=<prefix>/lib/pkgconfig pkg-config --cflags symphony

If you want to use the OSI interface, you need to replace "symphony" with
"osi-sym" in the above command.

Another alternative is that the output of the pkg-config command is also
automatically installed in <prefix>/share/coin/doc/SYMPHONY/sym_addlibs.txt.

This should get you going. Let me know if you have additional questions.

Cheers,

Ted

On Sat, Dec 1, 2012 at 11:03 AM, Hugh Medal <hugh.medal at msstate.edu> wrote:

> Thank you Ted.
>
> *Here is my info:*
> OS: Linux (Ubuntu 12.04)
> Compiler: g++ (version 4.6.3)
> SYMPHONY version: 5.4.4
> Eclipse version: 4.2.0; using CDT plugin
>
> *Steps I have taken:*
> 1. Installed SYMPHONY 5.4.4 into my /opt directory (using ./configure,
> make, make install; I ran make test and it was successful)
> 2. Added the symphony include directories to Eclipse
> - Project > Properties > C/C++ Compiler > Settings > GCC C++ Compiler
> > Includes
> - added /opt/SYMPHONY-5.4.4/include
> and /opt/SYMPHONY-5.4.4/SYMPHONY/include to the "include paths" list
> 3. Added the symphony lib directory to Eclipse
> - Project > Properties > C/C++ Compiler > Settings > GCC C++ Linker
> > Libraries
> - added /opt/SYMPHONY-5.4.4/lib to the "Library search path" list
> 3. Added the symphony Libraries Eclipse
> - Project > Properties > C/C++ Compiler > Settings > GCC C++ Linker
> > Libraries
> - added "Sym" to the "Libraries" list (I am not sure if I need to add an
> more libraries)
> 4. Created a C++ project
> 5. Created the following .cpp file
>
> #include "coin/OsiSymSolverInterface.hpp"
>
> int main(int argc, char **argv)
> {
> OsiSymSolverInterface osi;
> }
>
> *Problems:*
> When I build my project, I am getting this message (see errors in bold):
>
> make all
> Building file: ../src/MySource.cpp
> Invoking: GCC C++ Compiler
> g++ -I/opt/ibm/ILOG/CPLEX_Studio124/cplex/include
> -I/opt/ibm/ILOG/CPLEX_Studio124/concert/include
> -I/opt/SYMPHONY-5.4.4/include -I/opt/SYMPHONY-5.4.4/SYMPHONY/include -O0
> -g3 -Wall -c -fmessage-length=0 -m32 -O -fPIC -fno-strict-aliasing
> -fexceptions -DNDEBUG -DIL_STD -MMD -MP -MF"src/MySource.d"
> -MT"src/MySource.d" -o "src/MySource.o" -c "../src/MySource.cpp"
> Finished building: ../src/MySource.cpp
>
> Building target: HughCPP
> Invoking: GCC C++ Linker
> g++ -L/opt/ibm/ILOG/CPLEX_Studio124/cplex/lib/x86_sles10_4.1/static_pic
> -L/opt/ibm/ILOG/CPLEX_Studio124/concert/lib/x86_sles10_4.1/static_pic
> -L/opt/SYMPHONY-5.4.4/lib -o "HughCPP"  ./src/Lottery.o ./src/MegaLottery.o
> ./src/MySource.o   -lilocplex -lcplex -lconcert -lm -lpthread -lSym
> ./src/MySource.o: In function `main':
> */home/hmedal/Documents/2_msu/research_manager/code/ide/eclipse/HughCPP/Debug/../src/MySource.cpp:125:
> undefined reference to `OsiSymSolverInterface::OsiSymSolverInterface()'*
> */home/hmedal/Documents/2_msu/research_manager/code/ide/eclipse/HughCPP/Debug/../src/MySource.cpp:125:
> undefined reference to `OsiSymSolverInterface::~OsiSymSolverInterface()'*
> *collect2: ld returned 1 exit status*
> *make: *** [HughCPP] Error 1*
>
>
> On Fri, Nov 30, 2012 at 9:38 AM, Ted Ralphs <ted at lehigh.edu> wrote:
>
>> I use Eclipse and can probably help, but you'll have to give some more
>> information, such as
>>
>> 1. OS
>> 2. Compiler
>> 3. SYMPHONY version
>> 4. What problems you've encountered
>>
>> Cheers,
>>
>> Ted
>>
>> On Thu, Nov 29, 2012 at 8:40 PM, Hugh Medal <hugh.medal at msstate.edu>wrote:
>>
>>> Hello,
>>>
>>> Has anyone had success getting SYMPHONY to work with Eclipse CDT? I
>>> tried some instructions for SMI (
>>> https://projects.coin-or.org/BuildTools/wiki/pm-howdoi) but couldn't
>>> get them to work.
>>>
>>> Thanks,
>>> Hugh
>>>
>>> --
>>> Hugh Medal
>>> Assistant Professor
>>> Industrial and Systems Engineering
>>> Mississippi State University
>>> Office: 260K McCain
>>> Office: 662-325-3923
>>> Cell Phone: 701-866-1179
>>> Email: hmedal at i <hmedal at uark.edu>se.msstate.edu
>>> Website: hm568.ise.msstate.edu
>>> Twitter: hughmedal <https://twitter.com/#!/hughmedal>
>>> Facebook: Hugh Medal <http://www.facebook.com/hugh.medal>
>>> LinkedIn: Hugh Medal<http://www.linkedin.com/profile/view?id=65478854&authType=name&authToken=lX4B&pvs=pp>
>>> Google+: Hugh Medal<https://plus.google.com/111704068836614551361/posts>
>>>
>>>
>>> _______________________________________________
>>> Symphony mailing list
>>> Symphony at list.coin-or.org
>>> http://list.coin-or.org/mailman/listinfo/symphony
>>>
>>>
>>
>>
>> --
>> Dr. Ted Ralphs
>> Associate Professor, Lehigh University
>> (610) 628-1280
>> ted 'at' lehigh 'dot' edu
>> coral.ie.lehigh.edu/~ted
>>
>>
>
>
> --
> Hugh Medal
> Assistant Professor
> Industrial and Systems Engineering
> Mississippi State University
> Office: 260K McCain
> Office: 662-325-3923
> Cell Phone: 701-866-1179
> Email: hmedal at i <hmedal at uark.edu>se.msstate.edu
> Website: hm568.ise.msstate.edu
> Twitter: hughmedal <https://twitter.com/#!/hughmedal>
> Facebook: Hugh Medal <http://www.facebook.com/hugh.medal>
> LinkedIn: Hugh Medal<http://www.linkedin.com/profile/view?id=65478854&authType=name&authToken=lX4B&pvs=pp>
> Google+: Hugh Medal <https://plus.google.com/111704068836614551361/posts>
>
>


-- 
Dr. Ted Ralphs
Associate Professor, Lehigh University
(610) 628-1280
ted 'at' lehigh 'dot' edu
coral.ie.lehigh.edu/~ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/symphony/attachments/20121202/b028ba54/attachment.html>


More information about the Symphony mailing list