[Lemon-user] Using Lemon with CPLEX Concert on Windows with Visual C++ 2008
Luis de la Torre
ledelato at gmail.com
Wed May 18 19:07:49 CEST 2011
Thanks for trying! It's the "_using the same config_" that isn't
working under Windows. In any case, getting them to work together in
Linux was painless and I'm up and running now, just not in Windows.
- Luis
On Wed, May 18, 2011 at 1:57 AM, Alpár Jüttner <alpar at cs.elte.hu> wrote:
> Hi,
>
> It's difficult for me to help, as I cannot reproduce your problem. Also,
> the error log still looks quite unrelated to LEMON.
>
> The only thing I can suggest is trying to localize the problem somehow.
> For example
> * First try to compile and link a sample code using LEMON only
> * Then, try to compile and link a sample code using CPLEX only
> * Finally, if the both are working _using the same config_, then
> try using them together.
>
> Regards,
> Alpar
>
>> Thanks for the suggestions Alpar. When I used the /NODEFAULTLIB
>> (following in the instructions at
>> http://msdn.microsoft.com/en-us/library/f1tbxcxh(v=vs.80).aspx)
>>
>> I get different errors:
>>
>> 1>------ Build started: Project: tryLemonAlone, Configuration: Release
>> Win32 ------
>> 1>Compiling...
>> 1>main.cpp
>> 1>Linking...
>> 1>main.obj : error LNK2001: unresolved external symbol
>> __invalid_parameter_noinfo
>> 1>libcpmt.lib(cout.obj) : error LNK2001: unresolved external symbol
>> __invalid_parameter_noinfo
>> 1>libcpmt.lib(cerr.obj) : error LNK2001: unresolved external symbol
>> __invalid_parameter_noinfo
>> 1>libcpmt.lib(_tolower.obj) : error LNK2001: unresolved external
>> symbol __calloc_crt
>> 1>libcpmt.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol
>> __malloc_crt
>> 1>C:\Users\luis\Documents\singleStopProblem\tryLemonAlone\Release\tryLemonAlone.exe
>> : fatal error LNK1120: 3 unresolved externals
>> 1>Build log was saved at
>> "file://c:\Users\luis\Documents\tryLemonAlone\tryLemonAlone\Release\BuildLog.htm"
>> 1>tryLemonAlone - 6 error(s), 0 warning(s)
>> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>>
>> Here's an example of a short piece of code where Concert works with
>> lemon and without it, followed by the errors. The errors I've gotten
>> this time are different and more numerous, in the previous code, I was
>> not actually using any Concert libraries.
>>
>> I think the problem may be with how I'm trying to use GraphWriter. In
>> the code shown below, if I delete the last bit of code where
>> GraphWriter is called, the code compiles and runs fine. With the
>> GraphWriter code included, I get the following errors:
>>
>> 1>------ Build started: Project: testSingleStopAGAIN, Configuration:
>> Release Win32 ------
>> 1>Compiling...
>> 1>main.cpp
>> 1>Linking...
>> 1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined
>> in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __initterm_e already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _exit already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __exit already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(crt0dat.obj) : error LNK2005: __cexit already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(dosmap.obj) : error LNK2005: __errno already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
>> MSVCRTD.lib(cinitexe.obj)
>> 1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
>> MSVCRTD.lib(cinitexe.obj)
>> 1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
>> MSVCRTD.lib(cinitexe.obj)
>> 1>LIBCMT.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
>> MSVCRTD.lib(cinitexe.obj)
>> 1>LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(tidtable.obj) : error LNK2005: __decode_pointer already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(hooks.obj) : error LNK2005: "void __cdecl
>> terminate(void)" (?terminate@@YAXXZ) already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(winxfltr.obj) : error LNK2005: __XcptFilter already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(crt0.obj) : error LNK2005: _mainCRTStartup already
>> defined in MSVCRTD.lib(crtexe.obj)
>> 1>LIBCMT.lib(errmode.obj) : error LNK2005: ___set_app_type already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(mlock.obj) : error LNK2005: __unlock already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(mlock.obj) : error LNK2005: __lock already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(setlocal.obj) : error LNK2005: __configthreadlocale
>> already defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(setlocal.obj) : error LNK2005: __free_locale already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(setlocal.obj) : error LNK2005: __create_locale already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(setlocal.obj) : error LNK2005: _setlocale already defined
>> in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(ctype.obj) : error LNK2005: ___pctype_func already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(initctyp.obj) : error LNK2005: ____mb_cur_max_l_func
>> already defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(initctyp.obj) : error LNK2005: ____lc_codepage_func
>> already defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(initctyp.obj) : error LNK2005: ____lc_handle_func already
>> defined in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(lconv.obj) : error LNK2005: _localeconv already defined
>> in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(atox.obj) : error LNK2005: _atoi already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(xtoas.obj) : error LNK2005: __ui64toa_s already defined
>> in MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(getenv.obj) : error LNK2005: _getenv already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(tolower.obj) : error LNK2005: _tolower already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LIBCMT.lib(strtol.obj) : error LNK2005: _strtol already defined in
>> MSVCRTD.lib(MSVCR90D.dll)
>> 1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of
>> other libs; use /NODEFAULTLIB:library
>> 1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of
>> other libs; use /NODEFAULTLIB:library
>> 1>C:\Users\luis\Documents\testSingleStopAGAIN\Release\testSingleStopAGAIN.exe
>> : fatal error LNK1169: one or more multiply defined symbols found
>> 1>Build log was saved at
>> "file://c:\Users\luis\Documents\testSingleStopAGAIN\Release\BuildLog.htm"
>> 1>testSingleStopAGAIN - 34 error(s), 2 warning(s)
>> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>>
>>
>>
>>
>>
>> #include <ilcplex/ilocplex.h>
>> #include <ctime>
>> #include <sstream>
>>
>> #include <lemon/list_graph.h>
>> #include <lemon/lgf_reader.h>
>> #include <lemon/lgf_writer.h>
>>
>>
>> ILOSTLBEGIN
>>
>> using namespace std;
>> using namespace lemon;
>>
>> int main() {
>> IloEnv env;
>> return 0;
>>
>> 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, cout).
>> edgeMap("capacity", weight).
>> run();
>> } catch (Exception& error) { // check if there was any error
>> std::cerr << "Error: " << error.what() << std::endl;
>> return -1;
>> }
>>
>> }
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, May 15, 2011 at 3:52 AM, Alpár Jüttner <alpar at cs.elte.hu> wrote:
>> > 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
>> >>
>> >
>> >
>> >
>>
>
>
>
--
Luis de la Torre
PhD Candidate
Industrial Engineering and Management Sciences
Northwestern University
2145 Sheridan Road
Evanston, IL 60208
More information about the Lemon-user
mailing list