Strange linker errors

First I make and install velocypack, it was easy.
Next I try make arangodb/fuerte
Compilation was OK, but appears linker errors:multiple definition of arangodb:name:name
found /usr/local/lib/libvelocypack.a with the same
(I do issue: https://github.com/arangodb/fuerte/issues/27)


[ 88%] Linking CXX executable fuerte-get [ 91%] Building CXX object tests/CMakeFiles/test_main.dir/test_connection_failures.cpp.o /usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0x800): multiple definition of arangodb::velocypack::SliceStaticData::FirstSubMap'; libfuerte.a(vst.cpp.o):(.rodata._ZN8arangodb10velocypack15SliceStaticData11FirstSubMapE[_ZN8arangodb10velocypack15SliceStaticData11FirstSubMapE]+0x0): first defined here
/usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0x880): multiple definition of arangodb::velocypack::SliceStaticData::WidthMap'; CMakeFiles/fuerte-get.dir/tools/fuerte-get.cpp.o:(.rodata._ZN8arangodb10velocypack15SliceStaticData8WidthMapE[_ZN8arangodb10velocypack15SliceStaticData8WidthMapE]+0x0): first defined here /usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0x900): multiple definition of arangodb::velocypack::SliceStaticData::TypeMap'; CMakeFiles/fuerte-get.dir/tools/fuerte-get.cpp.o:(.rodata._ZN8arangodb10velocypack15SliceStaticData7TypeMapE[_ZN8arangodb10velocypack15SliceStaticData7TypeMapE]+0x0): first defined here
/usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0xa00): multiple definition of arangodb::velocypack::SliceStaticData::FixedTypeLengths'; CMakeFiles/fuerte-get.dir/tools/fuerte-get.cpp.o:(.rodata._ZN8arangodb10velocypack15SliceStaticData16FixedTypeLengthsE[_ZN8arangodb10velocypack15SliceStaticData16FixedTypeLengthsE]+0x0): first defined here collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/fuerte-get.dir/build.make:91: fuerte-get] Error 1 make[1]: *** [CMakeFiles/Makefile2:161: CMakeFiles/fuerte-get.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 94%] Building CXX object tests/CMakeFiles/test_main.dir/test_connection_timeouts.cpp.o [ 97%] Building CXX object tests/CMakeFiles/test_main.dir/test_connection_users.cpp.o [100%] Linking CXX executable test_main /usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0x800): multiple definition of arangodb::velocypack::SliceStaticData::FirstSubMap'; CMakeFiles/test_main.dir/test_connection_basic.cpp.o:(.rodata._ZN8arangodb10velocypack15SliceStaticData11FirstSubMapE[_ZN8arangodb10velocypack15SliceStaticData11FirstSubMapE]+0x0): first defined here
/usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0x880): multiple definition of arangodb::velocypack::SliceStaticData::WidthMap'; CMakeFiles/test_main.dir/test_connection_basic.cpp.o:(.rodata._ZN8arangodb10velocypack15SliceStaticData8WidthMapE[_ZN8arangodb10velocypack15SliceStaticData8WidthMapE]+0x0): first defined here /usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0x900): multiple definition of arangodb::velocypack::SliceStaticData::TypeMap'; CMakeFiles/test_main.dir/test_connection_basic.cpp.o:(.rodata._ZN8arangodb10velocypack15SliceStaticData7TypeMapE[_ZN8arangodb10velocypack15SliceStaticData7TypeMapE]+0x0): first defined here
/usr/bin/ld: /usr/local/lib/libvelocypack.a(SliceStaticData.cpp.o):(.rodata+0xa00): multiple definition of `arangodb::velocypack::SliceStaticData::FixedTypeLengths'; CMakeFiles/test_main.dir/test_connection_basic.cpp.o:(.rodata._ZN8arangodb10velocypack15SliceStaticData16FixedTypeLengthsE[_ZN8arangodb10velocypack15SliceStaticData16FixedTypeLengthsE]+0x0): first defined here
It seems that text after "first defined here" is empty
"Multiple definition" of a function, usually means that you've put the entire definition of a free function into a header file, which means it's being defined in multiple translation units.

Declare the function in a header file.

Define the function in a single source file.
My trial of solution:

https://github.com/arangodb/velocypack/issues/70

Problem with fuerte can be solved changing

velocypack/CMakeLists.txt

Line 6 in d11b92e
set(CMAKE_CXX_STANDARD 11 CACHE STRING "target C++ standard")

from set(CMAKE_CXX_STANDARD 11 CACHE STRING "target C++ standard")
to set(CMAKE_CXX_STANDARD 17 CACHE STRING "target C++ standard")
see: arangodb/fuerte#27
Registered users can post here. Sign in or register to post.