Link fails
stolk opened this issue · 1 comments
stolk commented
The linking fails with an endless spew of "multiple definition" for symbols in the header files.
Is it missing 'extern' keywords?
make -C SRC all
make[1]: Entering directory '/home/bram/src/VSR-LKH/SRC'
make LKH
make[2]: Entering directory '/home/bram/src/VSR-LKH/SRC'
cc -o ../LKH OBJ/Activate.o OBJ/AddCandidate.o OBJ/AddExtraCandidates.o OBJ/AddTourCandidates.o OBJ/AdjustCandidateSet.o OBJ/AdjustClusters.o OBJ/AllocateStructures.o OBJ/Ascent.o OBJ/Best2OptMove.o OBJ/Best3OptMove.o OBJ/Best4OptMove.o OBJ/Best5OptMove.o OBJ/BestKOptMove.o OBJ/Between.o OBJ/Between_SL.o OBJ/Between_SSL.o OBJ/BridgeGain.o OBJ/BuildKDTree.o OBJ/C.o OBJ/CandidateReport.o OBJ/ChooseInitialTour.o OBJ/Connect.o OBJ/CreateCandidateSet.o OBJ/CreateDelaunayCandidateSet.o OBJ/CreateNNCandidateSet.o OBJ/Create_POPMUSIC_CandidateSet.o OBJ/CreateQuadrantCandidateSet.o OBJ/Delaunay.o OBJ/Distance.o OBJ/Distance_SPECIAL.o OBJ/eprintf.o OBJ/ERXT.o OBJ/Excludable.o OBJ/Exclude.o OBJ/FindTour.o OBJ/FixedOrCommonCandidates.o OBJ/Flip.o OBJ/Flip_SL.o OBJ/Flip_SSL.o OBJ/Forbidden.o OBJ/FreeStructures.o OBJ/fscanint.o OBJ/Gain23.o OBJ/GenerateCandidates.o OBJ/Genetic.o OBJ/GeoConversion.o OBJ/GetTime.o OBJ/GreedyTour.o OBJ/Hashing.o OBJ/Heap.o OBJ/IsBackboneCandidate.o OBJ/IsCandidate.o OBJ/IsCommonEdge.o OBJ/IsPossibleCandidate.o OBJ/KSwapKick.o OBJ/LinKernighan.o OBJ/LKHmain.o OBJ/Make2OptMove.o OBJ/Make3OptMove.o OBJ/Make4OptMove.o OBJ/Make5OptMove.o OBJ/MakeKOptMove.o OBJ/MergeTourWithBestTour.o OBJ/MergeWithTourIPT.o OBJ/Minimum1TreeCost.o OBJ/MinimumSpanningTree.o OBJ/NormalizeNodeList.o OBJ/NormalizeSegmentList.o OBJ/OrderCandidateSet.o OBJ/PatchCycles.o OBJ/printff.o OBJ/PrintParameters.o OBJ/Random.o OBJ/ReadCandidates.o OBJ/ReadEdges.o OBJ/ReadLine.o OBJ/ReadParameters.o OBJ/ReadPenalties.o OBJ/ReadProblem.o OBJ/RecordBestTour.o OBJ/RecordBetterTour.o OBJ/RemoveFirstActive.o OBJ/ResetCandidateSet.o OBJ/RestoreTour.o OBJ/SegmentSize.o OBJ/Sequence.o OBJ/SFCTour.o OBJ/SolveCompressedSubproblem.o OBJ/SolveDelaunaySubproblems.o OBJ/SolveKarpSubproblems.o OBJ/SolveKCenterSubproblems.o OBJ/SolveKMeansSubproblems.o OBJ/SolveRoheSubproblems.o OBJ/SolveSFCSubproblems.o OBJ/SolveSubproblem.o OBJ/SolveSubproblemBorderProblems.o OBJ/SolveTourSegmentSubproblems.o OBJ/Statistics.o OBJ/StoreTour.o OBJ/SymmetrizeCandidateSet.o OBJ/TrimCandidateSet.o OBJ/WriteCandidates.o OBJ/WritePenalties.o OBJ/WriteTour.o OBJ/MergeWithTourGPX2.o OBJ/gpx.o -O3 -Wall -IINCLUDE -DTWO_LEVEL_TREE -g -lm
/usr/bin/ld: OBJ/AddCandidate.o:/home/bram/src/VSR-LKH/SRC/INCLUDE/LKH.h:207: multiple definition of `FirstNode'; OBJ/Activate.o:/home/bram/src/VSR-LKH/SRC/INCLUDE/LKH.h:207: first defined here
This is on Ubuntu 20.10
LongWang7 commented
because the version of gcc is not matched with Ununtu.
the solution you can add extern one by one,or degrade the version of gcc to 9
after doing this,the code could be implemented.