[Lemon-user] Using Lemon with CPLEX Concert on Windows with Visual C++ 2008
Alpár Jüttner
alpar at cs.elte.hu
Sun May 15 10:52:33 CEST 2011
Hi,
> I'm trying to use Lemon and CPLEX Concert in the same code. I'm
> running into linker problems. Concert has a number of settings in its
> installation instructions, and after adding and removing them one by
> one the culprit seems to be setting the runtime library to
> multi-threaded (/MT).
I do not believe this problem has anything to do with LEMON.
Also, the conflicting libs in the error message are unrelated to LEMON.
Can you show an example code using CPLEX Concert and MT which compiles
and links without LEMON, but not with it?
Regards,
Alpar
P.S. Btw, have you tried using the compiler option /NODEFAULTLIB:library
as it is suggested by the error log you sent?
> Below are the linker errors I'm getting, and the code that gives me
> these errors when I try to link. Without the the change of runtime
> library to multi-threaded, the code compiles and runs correctly.
>
> Does anyone know what settings I should be using to use CPLEX together
> with Lemon?
>
> Thank you,
>
> Luis de la Torre
>
>
> 1>------ Build started: Project: tryLemonAlone, Configuration: Release
> Win32 ------
> 1>Compiling...
> 1>main.cpp
> 1>Linking...
> 1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall
> type_info::type_info(class type_info const &)"
> (??0type_info@@AAE at ABV0@@Z) already defined in LIBCMT.lib(typinfo.obj)
> 1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info
> & __thiscall type_info::operator=(class type_info const &)"
> (??4type_info@@AAEAAV0 at ABV0@@Z) already defined in
> LIBCMT.lib(typinfo.obj)
> 1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
> other libs; use /NODEFAULTLIB:library
> 1>C:\Users\luis\Documents\tryLemonAlone\Release\tryLemonAlone.exe :
> fatal error LNK1169: one or more multiply defined symbols found
> 1>Build log was saved at
> "file://c:\Users\luis\Documents\tryLemonAlone\tryLemonAlone\Release\BuildLog.htm"
> 1>tryLemonAlone - 3 error(s), 1 warning(s)
> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>
>
>
>
> This tiny piece of code:
>
> #include <iostream>
> #include <lemon/list_graph.h>
> #include <lemon/lgf_reader.h>
> #include <lemon/lgf_writer.h>
>
> using namespace lemon;
> using namespace std;
>
> int main() {
> int nDemand = 12;
> int nVehicles = 6;
> int nDays = 2;
> cout << "hello there " << endl;
> //write the graph file
> ofstream graphFile("g.lgf");
> if(!graphFile) {
> cout << "Cannot open graph file.\n";
> return 1;
> }
> graphFile << "@nodes" << endl << "label" << endl;
>
> for(int i = 0; i < nDemand+nVehicles; i++) {
> graphFile << i << endl;
> }
> graphFile << "@edges" << endl << endl;
> graphFile << " label capacity" << endl;
> int m = 0;
> for(int i = 0; i < nDemand; i++) {
> for(int k = 0; k < nVehicles; k++) {
> m++;
> graphFile << i << " " << k+nDemand << " " << m << " " << "
> " << 1 << endl;
> }
> }
> graphFile.close();
>
> ListGraph g;
> ListGraph::EdgeMap<int> weight(g);
> ListGraph::NodeMap<int> available(g);
> ListGraph::NodeMap<int> assigned(g);
>
> try {
> GraphReader<ListGraph>(g, "g.lgf").
> edgeMap("capacity", weight).
> run();
> } catch (Exception& error) { // check if there was any error
> std::cerr << "Error: " << error.what() << std::endl;
> return -1;
> }
> try {
> GraphWriter<ListGraph>(g, std::cout).
> edgeMap("capacity", weight).
> run();
> } catch (Exception& error) { // check if there was any error
> std::cerr << "Error: " << error.what() << std::endl;
> return -1;
> }
>
> for(ListGraph::NodeIt it(g); it != INVALID; ++it) {
> cout << g.id(it) << endl;
> }
>
> return 0;
> }
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
>
More information about the Lemon-user
mailing list