pgRouting / pgrouting

Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
https://pgrouting.org
GNU General Public License v2.0
1.16k stars 366 forks source link

Problem Compiling Tester.cpp in vrp_basic #292

Closed shulaxan closed 9 years ago

shulaxan commented 9 years ago

Testertest.cpp: In function ‘void dlog2(char)’: Tester_test.cpp:12:16: warning: format not a string literal and no format arguments [-Wformat-security] fprintf(fp,ptr); ^ Tester_test.cpp: In function ‘void loadOrders()’: Testertest.cpp:26:23: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] dlog2("REACHED ORDER"); ^ Tester_test.cpp: In function ‘void loadVehicles()’: Testertest.cpp:110:26: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] dlog2("REACHED VEHICLES"); ^ Tester_test.cpp: In function ‘void loadDistanceMatrix()’: Testertest.cpp:154:33: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] dlog2("REACHED DISTANCE MATRIX"); ^ Tester_test.cpp: In function ‘bool print_solution(std::string)’: Testertest.cpp:199:24: warning: deprecated conversion from string constant to ‘char’ [-Wwrite-strings] dlog2("REACHED RESULT"); ^ /tmp/cc8oiyrb.o: In function loadOrders()': Tester_test.cpp:(.text+0x201): undefined reference toCDepotInfo::CDepotInfo()' Tester_test.cpp:(.text+0x36b): undefined reference to CVRPSolver::addDepot(CDepotInfo)' Tester_test.cpp:(.text+0x376): undefined reference toCDepotInfo::~CDepotInfo()' Tester_test.cpp:(.text+0x388): undefined reference to CDepotInfo::~CDepotInfo()' Tester_test.cpp:(.text+0x398): undefined reference toCOrderInfo::COrderInfo()' Tester_test.cpp:(.text+0x584): undefined reference to CVRPSolver::addOrder(COrderInfo)' Tester_test.cpp:(.text+0x58f): undefined reference toCOrderInfo::~COrderInfo()' Tester_test.cpp:(.text+0x59a): undefined reference to COrderInfo::~COrderInfo()' Tester_test.cpp:(.text+0x653): undefined reference toCDepotInfo::~CDepotInfo()' Tester_test.cpp:(.text+0x662): undefined reference to CDepotInfo::~CDepotInfo()' Tester_test.cpp:(.text+0x671): undefined reference toCOrderInfo::~COrderInfo()' Tester_test.cpp:(.text+0x680): undefined reference to COrderInfo::~COrderInfo()' /tmp/cc8oiyrb.o: In functionloadVehicles()': Tester_test.cpp:(.text+0x83c): undefined reference to CVehicleInfo::CVehicleInfo()' Tester_test.cpp:(.text+0x8ee): undefined reference toCVRPSolver::addVehicle(CVehicleInfo)' Tester_test.cpp:(.text+0x8f9): undefined reference to CVehicleInfo::~CVehicleInfo()' Tester_test.cpp:(.text+0x904): undefined reference toCVehicleInfo::~CVehicleInfo()' Tester_test.cpp:(.text+0x9b1): undefined reference to CVehicleInfo::~CVehicleInfo()' Tester_test.cpp:(.text+0x9c0): undefined reference toCVehicleInfo::~CVehicleInfo()' /tmp/cc8oiyrb.o: In function loadDistanceMatrix()': Tester_test.cpp:(.text+0xc3e): undefined reference toCVRPSolver::addDepotToOrderCost(int, int, CostPack)' Tester_test.cpp:(.text+0xc8d): undefined reference to CVRPSolver::addOrderToDepotCost(int, int, CostPack)' Tester_test.cpp:(.text+0xcd3): undefined reference toCVRPSolver::addOrderToOrderCost(int, int, CostPack)' /tmp/cc8oiyrb.o: In function print_solution(std::string)': Tester_test.cpp:(.text+0xe06): undefined reference toCSolutionInfo::CSolutionInfo()' Tester_test.cpp:(.text+0xe23): undefined reference to CVRPSolver::getSolution(CSolutionInfo&, std::string&)' Tester_test.cpp:(.text+0xe89): undefined reference toCTourInfo::CTourInfo()' Tester_test.cpp:(.text+0x1138): undefined reference to CTourInfo::~CTourInfo()' Tester_test.cpp:(.text+0x1146): undefined reference toCSolutionInfo::~CSolutionInfo()' Tester_test.cpp:(.text+0x1169): undefined reference to CTourInfo::~CTourInfo()' Tester_test.cpp:(.text+0x117b): undefined reference toCSolutionInfo::~CSolutionInfo()' /tmp/cc8oiyrb.o: In function main': Tester_test.cpp:(.text+0x11c3): undefined reference toCVRPSolver::solveVRP(std::string&)' /tmp/cc8oiyrb.o: In function __static_initialization_and_destruction_0(int, int)': Tester_test.cpp:(.text+0x12b2): undefined reference toCVRPSolver::CVRPSolver()' Tester_test.cpp:(.text+0x12c9): undefined reference to CVRPSolver::~CVRPSolver()' /tmp/cc8oiyrb.o: In functionCTourInfo::CTourInfo(CTourInfo const&)': Tester_test.cpp:(.text.ZN9CTourInfoC2ERKS[ZN9CTourInfoC5ERKS]+0xbe): undefined reference to CVehicleInfo::~CVehicleInfo()' /tmp/cc8oiyrb.o: In functionvoid std::Destroy(CTourInfo)': Tester_test.cpp:(.text._ZSt8DestroyI9CTourInfoEvPT[_ZSt8DestroyI9CTourInfoEvPT]+0xd): undefined reference to `CTourInfo::~CTourInfo()' collect2: error: ld returned 1 exit status

Can anyone suggest me how to compile it ??

manikanta-kondeti commented 9 years ago

Try this out:

  1. g++ Tester.cpp VRP_Solver.h VRP_Solver.cpp
  2. ./a.out

It will create a result.txt file which contains all the results.

shulaxan commented 9 years ago

Thank you !! As suggested it created a result.txt. But the problem was that I changed the contents of the Orders.txt, Distance.txt and Vehicles.txt as per my requirement in the same format as provided. But the result.txt showed as Total Number of Route: 0 Total Cost: 0.000 Total Distance: 0.000 Total TravelTime: 0.000

manikanta-kondeti commented 9 years ago

Forward your orders.txt to gmail(mani.iiit123@gmail.com). I will check that and let you know.

manikanta-kondeti commented 9 years ago

It gave me this following output:

Total Number of Route: 3 Total Cost: 332.765 Total Distance: 332.765 Total TravelTime: 424.027 Route No. 1: Vehicle Id: 1 Starting Depot Id: 1 End Depot Id: 1 Visited Order Ids: 7, 5 Route No. 2: Vehicle Id: 2 Starting Depot Id: 1 End Depot Id: 1 Visited Order Ids: 8 Route No. 3: Vehicle Id: 3 Starting Depot Id: 1 End Depot Id: 1 Visited Order Ids:

Just replace Orders.txt Distance.txt Vehicles.txt with your files keeping the filenames same. Check the output above.

shulaxan commented 9 years ago

Thank you !!!