I am trying to link a project to boost:filesystem on Ubuntu 13.04 and I am geting some weird linking errors in the last stage.
The build configuration is done via cmake:
find_package(Boost COMPONENTS system filesystem program_options REQUIRED )
include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})
target_link_libraries(${YARS_TARGET} yarsLib GLEW GL GLU glut m dl xerces-c ode ${Boost_LIBRARIES})
I tried using a different boost version. For 1.49 and 1.53 I have the same behaviour.
On Ubuntu 12.04 it does work just dine and on my development machine running Archlinux with boost 1.53 it compiles, links and runs just fine.
/usr/bin/g++ -O3 CMakeFiles/yars.dir/yarsMain.o -o ../bin/yars
-L/home/vagrant/local/lib -rdynamic ../lib/libyarsLib.a -lGLEW -lGL -lGLU
-lglut -lm -ldl -lxerces-c -lode -lboost_system
-lboost_filesystem -lboost_program_options
../lib/libsensorLib.a ../lib/libenvironmentLib.a ../lib/libutilLib.a ../lib/libutilFilterLib.a ../lib/libutilFormatLib.a ../lib/libutilFunctionGeneratorLib.a ../lib/libutilIoLib.a ../lib/libutilMathLib.a ../lib/libutilDefineLib.a ../lib/libdescriptionLib.a ../lib/libfilterDescriptionLib.a ../lib/libfunctionGeneratorDescriptionLib.a ../lib/libfunctionGeneratorDescriptionUtilLib.a ../lib/libbioDescriptionLib.a ../lib/libsensorsDescriptionLib.a ../lib/libyarsDirectoriesModel.a -Wl,-rpath,/home/vagrant/local/lib:
../lib/libutilIoLib.a(FileSystemOperations.o):
In function `FileSystemOperations::doesDirExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x27): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x3a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesFileExist(boost::filesystem::path)':
FileSystemOperations.cpp:(.text+0x67): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x7a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::doesDirExist(std::string*)':
FileSystemOperations.cpp:(.text+0xca): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xdf): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingDir(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x2c3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x35e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x373): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x403): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x43b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x453): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x50d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x564): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDirContainingFile(std::vector<std::string, std::allocator<std::string> >, std::string*)':
FileSystemOperations.cpp:(.text+0x7e3): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x87e): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x893): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x923): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x95b): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x973): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa2d): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0xa84): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::getFirstExistingDir(std::vector<std::string, std::allocator<std::string> >)':
FileSystemOperations.cpp:(.text+0xd53): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o):FileSystemOperations.cpp:(.text+0xd68): more undefined references to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' follow
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPath(std::string*, bool, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1100): undefined reference to `boost::filesystem::detail::initial_path(boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x1124): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x11e9): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1237): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x130a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x131f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x137b): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x13dc): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
../lib/libutilIoLib.a(FileSystemOperations.o): In function `FileSystemOperations::checkValidPathFromAlternatives(std::string*, std::string*, std::vector<std::string, std::allocator<std::string> >*, bool, std::string)':
FileSystemOperations.cpp:(.text+0x1635): undefined reference to `boost::filesystem::path::root_directory() const'
FileSystemOperations.cpp:(.text+0x1699): undefined reference to `boost::filesystem::path::operator/=(boost::filesystem::path const&)'
FileSystemOperations.cpp:(.text+0x16d0): undefined reference to `boost::filesystem::detail::system_complete(boost::filesystem::path const&, boost::system::error_code*)'
FileSystemOperations.cpp:(.text+0x173f): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
collect2: error: ld returned 1 exit status
Just a suggestion:
1)Check that your boost library contains required symbols, you can use something like this:
nm -D /usr/lib64/libboost_filesystem.so.1.52.0 | grep detail | c++filt | grep your names
2)Try to change order of linking library, for example put -lboost_bla-bla-bla to the end of command line, and run this command with g++ again, not use make or something, just copy paste command and make experiments with it.
I was facing errors like:
filename.cpp:(.text+0x389): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
filename.cpp:(.text+0x39c): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)'
obj/x86_64/release/filename.cpp.o: In function `readFromFileNotForm(boost::filesystem::path&, char*, unsigned int)':
filename.cpp:(.text+0x1291): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
obj/x86_64/release/filename.cpp.o: In function `readFromFileForm(boost::filesystem::path&, std::vector<unsigned int, std::allocator<unsigned int> >&)':
filename.cpp:(.text+0x167a): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
Other solutions did not work. I wrote this in my cpp file:
#include "boost/filesystem/v3/operations.hpp"
And the problem went away. I guess, it was not able to include it automatically. I also tried with v2, but that did not work, I had to do v3.
Related
I'm trying to include libtorch in a c++ project to use a neural network I previously trained in python. But when I try to compile and link I get an error with an undefined reference issue and also 'DSO missing from command line' but I am not sure what this means.
/usr/bin/ld: ../vendor/libtorch/lib/libtorch_cpu.so: undefined reference to symbol '_ZN3c106detail23torchInternalAssertFailEPKcS2_jS2_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
/usr/bin/ld: /home/joren/Coding/Waffle-empire/crypto-prediction/src/../vendor/libtorch/lib/libc10.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
I am using premake5 to generate my makefiles, as below:
workspace "CryptoPredict"
architecture "x64"
startproject "CryptoPredict"
configurations
{
"Debug",
"Release"
}
outputdir = "%{cfg.buildcfg}"
IncludeDir = {}
IncludeDir["crypto_com"] = "vendor/crypto_com/include"
IncludeDir["libtorch"] = "vendor/libtorch"
IncludeDir["json"] = "vendor/json/single_include"
IncludeDir["boost"] = "/usr/include/boost"
IncludeDir["websocketpp"] = "/usr/include/websocketpp"
CppVersion = "C++17"
-- crypto.com wrapper --
project "crypto_com"
location "vendor/%{prj.name}"
kind "StaticLib"
language "C++"
IncludeDir["cryptlite"] = "vendor/crypto_com/vendor/cpp-cryptlite/include"
includedirs {
"%{IncludeDir.boost}",
"%{IncludeDir.cryptlite}",
"%{IncludeDir.http_request}",
-- "%{IncludeDir.json}",
"%{IncludeDir.websocketpp}",
"include"
}
files {
"vendor/%{prj.name}/include/**.hpp",
"vendor/%{prj.name}/include/**.cpp"
}
-- prediction bot --
project "CryptoPredict"
location "src"
kind "ConsoleApp"
language "C++"
targetdir ("bin/" .. outputdir)
objdir ("bin/int/" .. outputdir .. "%{prj.name}")
PrecompiledHeaderInclude = "common.hpp"
PrecompiledHeaderSource = "%{prj.name}/src/common.cpp"
includedirs
{
"%{IncludeDir.crypto_com}",
"%{IncludeDir.json}",
"%{IncludeDir.libtorch}/include",
"%{IncludeDir.libtorch}/include/torch/csrc/api/include",
"src"
}
files
{
"src/**.asm",
"src/**.hpp",
"src/**.cpp",
"src/**.h"
}
libdirs
{
"bin/lib",
"%{IncludeDir.libtorch}/lib"
}
links
{
"crypto",
"pthread",
"ssl",
"crypto_com",
"torch",
"torch_cpu"
}
pchheader "%{PrecompiledHeaderInclude}"
pchsource "%{PrecompiledHeaderSource}"
forceincludes
{
"%{PrecompiledHeaderInclude}"
}
flags
{
"LinkTimeOptimization",
"NoImportLib",
"Maps",
"MultiProcessorCompile"
}
filter "configurations:Debug"
flags { }
defines { "DEBUG", "CHANGE_G3LOG_DEBUG_TO_DBUG" }
symbols "On"
filter "configurations:Release"
flags { "NoManifest" }
defines { "RELEASE", "NDEBUG" }
optimize "speed"
After adding LDFLAGS="-Wl,--copy-dt-needed-entries" to my make command, this issue seems solved but another appears, I now get a whole bunch (below is only a small sample) of undefined reference errors but no more DSO missing from command line.
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::sqrt_sparse_(at::Tensor&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::signbit_sparse_csr(at::Tensor const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::meta::structured_baddbmm::meta(at::Tensor const&, at::Tensor const&, at::Tensor const&, c10::Scalar const&, c10::Scalar const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `fLB::FLAGS_caffe2_workspace_stack_debug'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::meta::structured_smooth_l1_loss::meta(at::Tensor const&, at::Tensor const&, long, double)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `torch::jit::tensorexpr::kQUInt8'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::squeeze_quantized(at::Tensor const&, long)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::atanh_sparse_csr(at::Tensor const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `c10::IValue::isDoubleList() const'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::floor_sparse_csr(at::Tensor const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::structured_lerp_Scalar::impl(at::Tensor const&, at::Tensor const&, c10::Scalar const&, at::Tensor const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `typeinfo for torch::profiler::impl::CUDAStubs'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::_ops::index_add_::call(at::Tensor&, long, at::Tensor const&, at::Tensor const&, c10::Scalar const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::trunc_sparse_(at::Tensor&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::meta::structured__log_softmax_backward_data::meta(at::Tensor const&, at::Tensor const&, long, c10::ScalarType)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::_ops::_upsample_nearest_exact1d_backward::call(at::Tensor const&, c10::ArrayRef<long>, c10::ArrayRef<long>, c10::optional<double>)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::abs_sparse_csr_out(at::Tensor const&, at::Tensor&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `cv::Mat::Mat()'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::tanh_sparse_csr_out(at::Tensor const&, at::Tensor&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::has_internal_overlap(at::TensorBase const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::linalg_cross_out(at::Tensor const&, at::Tensor const&, long, at::Tensor&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::meta::structured__upsample_nearest_exact3d::meta(at::Tensor const&, c10::ArrayRef<long>, c10::optional<double>, c10::optional<double>, c10::optional<double>)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `cv::Mat::operator=(cv::Mat&&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::meta::structured_triangular_solve::meta(at::Tensor const&, at::Tensor const&, bool, bool, bool)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::atan_sparse_(at::Tensor&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `cv::Mat::~Mat()'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `at::native::structured_lerp_Tensor::impl(at::Tensor const&, at::Tensor const&, at::Tensor const&, at::Tensor const&)'
/usr/bin/ld: /usr/lib/libtorch_cuda.so: undefined reference to `caffe2::TensorProtos::TensorProtos(google::protobuf::Arena*, bool)'
You are not linking with a required library. I do not know pytorch very well, but from your output, it seems that you are missing OpenCV.
You need to add it to the links section.
My code was working fine on windows, now that I am trying to compile on ubuntu 20.4; I am getting this error; I am copying part of the error as there are a lot:
after runing : mpicc C.cpp -o C
usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xb8): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_capacity(unsigned long)'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xc4): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xda): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars(char*, char*, char*)'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xed): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_set_length(unsigned long)'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x10b): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x117): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x11c): undefined reference to `__cxa_rethrow'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x128): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `__gnu_cxx::new_allocator<int>::deallocate(int*, unsigned long)':
C.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE10deallocateEPim[_ZN9__gnu_cxx13new_allocatorIiE10deallocateEPim]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `__gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*)':
C.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv]+0x30): undefined reference to `std::__throw_bad_alloc()'
/usr/bin/ld: C.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv]+0x40): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: /tmp/ccNx3sbm.o:(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `MPI::Intercomm::~Intercomm()':
C.cpp:(.text._ZN3MPI9IntercommD0Ev[_ZN3MPI9IntercommD5Ev]+0x29): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `MPI::Graphcomm::~Graphcomm()':
C.cpp:(.text._ZN3MPI9GraphcommD0Ev[_ZN3MPI9GraphcommD5Ev]+0x29): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `MPI::Cartcomm::~Cartcomm()':
when I check mpirun --version: I get this : mpirun (Open MPI) 4.0.3
This error:
usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xb8): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_capacity(unsigned long)'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xc4): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_data() const'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xda): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars(char*, char*, char*)'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0xed): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_set_length(unsigned long)'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x10b): undefined reference to `__cxa_begin_catch'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x117): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose()'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x11c): undefined reference to `__cxa_rethrow'
/usr/bin/ld: C.cpp:(.text._ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag[_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_M_constructIPcEEvT_S7_St20forward_iterator_tag]+0x128): undefined reference to `__cxa_end_catch'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `__gnu_cxx::new_allocator<int>::deallocate(int*, unsigned long)':
C.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE10deallocateEPim[_ZN9__gnu_cxx13new_allocatorIiE10deallocateEPim]+0x20): undefined reference to `operator delete(void*)'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `__gnu_cxx::new_allocator<int>::allocate(unsigned long, void const*)':
C.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv]+0x30): undefined reference to `std::__throw_bad_alloc()'
/usr/bin/ld: C.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEmPKv]+0x40): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: /tmp/ccNx3sbm.o:(.data.rel.ro._ZTVN3MPI3WinE[_ZTVN3MPI3WinE]+0x48): undefined reference to `MPI::Win::Free()'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `MPI::Intercomm::~Intercomm()':
C.cpp:(.text._ZN3MPI9IntercommD0Ev[_ZN3MPI9IntercommD5Ev]+0x29): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `MPI::Graphcomm::~Graphcomm()':
C.cpp:(.text._ZN3MPI9GraphcommD0Ev[_ZN3MPI9GraphcommD5Ev]+0x29): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: /tmp/ccNx3sbm.o: in function `MPI::Cartcomm::~Cartcomm()':
Because you are compiling with mpicc:
Compiles and links MPI programs written in C
but you should be using in this case mpic++
mpic++ -- Open MPI C++ wrapper compiler
After installing the apache arrow library on my computer, I tried running the c++ code example in the website (https://github.com/apache/arrow/blob/master/cpp/examples/arrow/row-wise-conversion-example.cc) but consistently kept getting the same error. I though it was because of the compiler couldnot find the arrow directory but after putting the library in the same folder as the test, it still didnt run and kept giving the same error.
g++ test.cpp
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `VectorToColumnarTable(std::vector<data_row, std::allocator<data_row> > const&, std::shared_ptr<arrow::Table>*)':
test.cpp:(.text+0x5c): undefined reference to `arrow::default_memory_pool()'
/usr/bin/ld: test.cpp:(.text+0x49b): undefined reference to `arrow::ArrayBuilder::Finish(std::shared_ptr<arrow::Array>*)'
/usr/bin/ld: test.cpp:(.text+0x555): undefined reference to `arrow::ArrayBuilder::Finish(std::shared_ptr<arrow::Array>*)'
/usr/bin/ld: test.cpp:(.text+0x60f): undefined reference to `arrow::ArrayBuilder::Finish(std::shared_ptr<arrow::Array>*)'
/usr/bin/ld: test.cpp:(.text+0x6b6): undefined reference to `arrow::int64()'
/usr/bin/ld: test.cpp:(.text+0x70b): undefined reference to `arrow::field(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<arrow::DataType> const&, bool, std::shared_ptr<arrow::KeyValueMetadata const> const&)'
/usr/bin/ld: test.cpp:(.text+0x72e): undefined reference to `arrow::float64()'
/usr/bin/ld: test.cpp:(.text+0x783): undefined reference to `arrow::field(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<arrow::DataType> const&, bool, std::shared_ptr<arrow::KeyValueMetadata const> const&)'
/usr/bin/ld: test.cpp:(.text+0x7a6): undefined reference to `arrow::float64()'
/usr/bin/ld: test.cpp:(.text+0x7bf): undefined reference to `arrow::list(std::shared_ptr<arrow::DataType> const&)'
/usr/bin/ld: test.cpp:(.text+0x814): undefined reference to `arrow::field(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<arrow::DataType> const&, bool, std::shared_ptr<arrow::KeyValueMetadata const> const&)'
/usr/bin/ld: test.cpp:(.text+0xa1a): undefined reference to `arrow::Table::Make(std::shared_ptr<arrow::Schema> const&, std::vector<std::shared_ptr<arrow::Array>, std::allocator<std::shared_ptr<arrow::Array> > > const&, long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `ColumnarTableToVector(std::shared_ptr<arrow::Table> const&, std::vector<data_row, std::allocator<data_row> >*)':
test.cpp:(.text+0xef0): undefined reference to `arrow::int64()'
/usr/bin/ld: test.cpp:(.text+0xf45): undefined reference to `arrow::field(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<arrow::DataType> const&, bool, std::shared_ptr<arrow::KeyValueMetadata const> const&)'
/usr/bin/ld: test.cpp:(.text+0xf68): undefined reference to `arrow::float64()'
/usr/bin/ld: test.cpp:(.text+0xfbd): undefined reference to `arrow::field(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<arrow::DataType> const&, bool, std::shared_ptr<arrow::KeyValueMetadata const> const&)'
/usr/bin/ld: test.cpp:(.text+0xfe0): undefined reference to `arrow::float64()'
/usr/bin/ld: test.cpp:(.text+0xff9): undefined reference to `arrow::list(std::shared_ptr<arrow::DataType> const&)'
/usr/bin/ld: test.cpp:(.text+0x1048): undefined reference to `arrow::field(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<arrow::DataType> const&, bool, std::shared_ptr<arrow::KeyValueMetadata const> const&)'
/usr/bin/ld: test.cpp:(.text+0x11eb): undefined reference to `arrow::Schema::Equals(arrow::Schema const&, bool) const'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::detail::Fingerprintable::Fingerprintable()':
test.cpp:(.text._ZN5arrow6detail15FingerprintableC2Ev[_ZN5arrow6detail15FingerprintableC5Ev]+0xf): undefined reference to `vtable for arrow::detail::Fingerprintable'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::DataType::DataType(arrow::Type::type)':
test.cpp:(.text._ZN5arrow8DataTypeC2ENS_4Type4typeE[_ZN5arrow8DataTypeC5ENS_4Type4typeE]+0x45): undefined reference to `vtable for arrow::DataType'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NestedType::~NestedType()':
test.cpp:(.text._ZN5arrow10NestedTypeD2Ev[_ZN5arrow10NestedTypeD5Ev]+0x26): undefined reference to `arrow::DataType::~DataType()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::ListType::ListType(std::shared_ptr<arrow::Field> const&)':
test.cpp:(.text._ZN5arrow8ListTypeC2ERKSt10shared_ptrINS_5FieldEE[_ZN5arrow8ListTypeC5ERKSt10shared_ptrINS_5FieldEE]+0x3c): undefined reference to `vtable for arrow::ListType'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::Buffer::ZeroPadding()':
test.cpp:(.text._ZN5arrow6Buffer11ZeroPaddingEv[_ZN5arrow6Buffer11ZeroPaddingEv]+0x18): undefined reference to `arrow::Buffer::CheckMutable() const'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::Buffer::mutable_data()':
test.cpp:(.text._ZN5arrow6Buffer12mutable_dataEv[_ZN5arrow6Buffer12mutable_dataEv]+0x18): undefined reference to `arrow::Buffer::CheckMutable() const'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::TypeTraits<arrow::Int64Type>::type_singleton()':
test.cpp:(.text._ZN5arrow10TypeTraitsINS_9Int64TypeEE14type_singletonEv[_ZN5arrow10TypeTraitsINS_9Int64TypeEE14type_singletonEv]+0x27): undefined reference to `arrow::int64()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::TypeTraits<arrow::DoubleType>::type_singleton()':
test.cpp:(.text._ZN5arrow10TypeTraitsINS_10DoubleTypeEE14type_singletonEv[_ZN5arrow10TypeTraitsINS_10DoubleTypeEE14type_singletonEv]+0x27): undefined reference to `arrow::float64()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BufferBuilder::Resize(long, bool)':
test.cpp:(.text._ZN5arrow13BufferBuilder6ResizeElb[_ZN5arrow13BufferBuilder6ResizeElb]+0x76): undefined reference to `arrow::AllocateResizableBuffer(arrow::MemoryPool*, long, std::shared_ptr<arrow::ResizableBuffer>*)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BufferBuilder::Finish(std::shared_ptr<arrow::Buffer>*, bool)':
test.cpp:(.text._ZN5arrow13BufferBuilder6FinishEPSt10shared_ptrINS_6BufferEEb[_ZN5arrow13BufferBuilder6FinishEPSt10shared_ptrINS_6BufferEEb]+0x121): undefined reference to `arrow::AllocateBuffer(arrow::MemoryPool*, long, std::shared_ptr<arrow::Buffer>*)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::ArrayBuilder::ArrayBuilder(arrow::MemoryPool*)':
test.cpp:(.text._ZN5arrow12ArrayBuilderC2EPNS_10MemoryPoolE[_ZN5arrow12ArrayBuilderC5EPNS_10MemoryPoolE]+0x17): undefined reference to `vtable for arrow::ArrayBuilder'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::ArrayBuilder::UnsafeAppendToBitmap(unsigned char const*, long)':
test.cpp:(.text._ZN5arrow12ArrayBuilder20UnsafeAppendToBitmapEPKhl[_ZN5arrow12ArrayBuilder20UnsafeAppendToBitmapEPKhl]+0x2e): undefined reference to `arrow::ArrayBuilder::UnsafeSetNotNull(long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::ArrayBuilder::UnsafeAppendToBitmap(long, bool)':
test.cpp:(.text._ZN5arrow12ArrayBuilder20UnsafeAppendToBitmapElb[_ZN5arrow12ArrayBuilder20UnsafeAppendToBitmapElb]+0x2e): undefined reference to `arrow::ArrayBuilder::UnsafeSetNotNull(long)'
/usr/bin/ld: test.cpp:(.text._ZN5arrow12ArrayBuilder20UnsafeAppendToBitmapElb[_ZN5arrow12ArrayBuilder20UnsafeAppendToBitmapElb]+0x43): undefined reference to `arrow::ArrayBuilder::UnsafeSetNull(long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::ArrayBuilder::~ArrayBuilder()':
test.cpp:(.text._ZN5arrow12ArrayBuilderD2Ev[_ZN5arrow12ArrayBuilderD5Ev]+0x13): undefined reference to `vtable for arrow::ArrayBuilder'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::Int64Type>::NumericBuilder<arrow::Int64Type>(std::enable_if<std::integral_constant<bool, arrow::TypeTraits<arrow::Int64Type>::is_parameter_free>::value, arrow::MemoryPool*>::type)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_9Int64TypeEEC2IS1_EENSt9enable_ifIXsrSt17integral_constantIbXsrNS_10TypeTraitsIT_EE17is_parameter_freeEE5valueEPNS_10MemoryPoolEE4typeE[_ZN5arrow14NumericBuilderINS_9Int64TypeEEC5IS1_EENSt9enable_ifIXsrSt17integral_constantIbXsrNS_10TypeTraitsIT_EE17is_parameter_freeEE5valueEPNS_10MemoryPoolEE4typeE]+0x61): undefined reference to `arrow::default_memory_pool()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::DoubleType>::NumericBuilder<arrow::DoubleType>(std::enable_if<std::integral_constant<bool, arrow::TypeTraits<arrow::DoubleType>::is_parameter_free>::value, arrow::MemoryPool*>::type)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_10DoubleTypeEEC2IS1_EENSt9enable_ifIXsrSt17integral_constantIbXsrNS_10TypeTraitsIT_EE17is_parameter_freeEE5valueEPNS_10MemoryPoolEE4typeE[_ZN5arrow14NumericBuilderINS_10DoubleTypeEEC5IS1_EENSt9enable_ifIXsrSt17integral_constantIbXsrNS_10TypeTraitsIT_EE17is_parameter_freeEE5valueEPNS_10MemoryPoolEE4typeE]+0x61): undefined reference to `arrow::default_memory_pool()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BaseListBuilder<arrow::ListType>::BaseListBuilder(arrow::MemoryPool*, std::shared_ptr<arrow::ArrayBuilder> const&)':
test.cpp:(.text._ZN5arrow15BaseListBuilderINS_8ListTypeEEC2EPNS_10MemoryPoolERKSt10shared_ptrINS_12ArrayBuilderEE[_ZN5arrow15BaseListBuilderINS_8ListTypeEEC5EPNS_10MemoryPoolERKSt10shared_ptrINS_12ArrayBuilderEE]+0x59): undefined reference to `arrow::list(std::shared_ptr<arrow::DataType> const&)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::Status arrow::Status::FromArgs<char const (&) [33]>(arrow::StatusCode, char const (&) [33])':
test.cpp:(.text._ZN5arrow6Status8FromArgsIJRA33_KcEEES0_NS_10StatusCodeEDpOT_[_ZN5arrow6Status8FromArgsIJRA33_KcEEES0_NS_10StatusCodeEDpOT_]+0x59): undefined reference to `arrow::Status::Status(arrow::StatusCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::Status arrow::Status::FromArgs<char const (&) [23]>(arrow::StatusCode, char const (&) [23])':
test.cpp:(.text._ZN5arrow6Status8FromArgsIJRA23_KcEEES0_NS_10StatusCodeEDpOT_[_ZN5arrow6Status8FromArgsIJRA23_KcEEES0_NS_10StatusCodeEDpOT_]+0x59): undefined reference to `arrow::Status::Status(arrow::StatusCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BaseListBuilder<arrow::ListType>::BaseListBuilder(arrow::MemoryPool*, std::shared_ptr<arrow::ArrayBuilder> const&, std::shared_ptr<arrow::DataType> const&)':
test.cpp:(.text._ZN5arrow15BaseListBuilderINS_8ListTypeEEC2EPNS_10MemoryPoolERKSt10shared_ptrINS_12ArrayBuilderEERKS5_INS_8DataTypeEE[_ZN5arrow15BaseListBuilderINS_8ListTypeEEC5EPNS_10MemoryPoolERKSt10shared_ptrINS_12ArrayBuilderEERKS5_INS_8DataTypeEE]+0xdd): undefined reference to `arrow::Field::WithType(std::shared_ptr<arrow::DataType> const&) const'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::Status arrow::Status::FromArgs<char const (&) [26]>(arrow::StatusCode, char const (&) [26])':
test.cpp:(.text._ZN5arrow6Status8FromArgsIJRA26_KcEEES0_NS_10StatusCodeEDpOT_[_ZN5arrow6Status8FromArgsIJRA26_KcEEES0_NS_10StatusCodeEDpOT_]+0x59): undefined reference to `arrow::Status::Status(arrow::StatusCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > arrow::util::StringBuilder<char const (&) [33]>(char const (&) [33])':
test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x2c): undefined reference to `arrow::util::detail::StringStreamWrapper::StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x65): undefined reference to `arrow::util::detail::StringStreamWrapper::str[abi:cxx11]()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x72): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA33_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x97): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > arrow::util::StringBuilder<char const (&) [23]>(char const (&) [23])':
test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x2c): undefined reference to `arrow::util::detail::StringStreamWrapper::StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x65): undefined reference to `arrow::util::detail::StringStreamWrapper::str[abi:cxx11]()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x72): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA23_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x97): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > arrow::util::StringBuilder<char const (&) [26]>(char const (&) [26])':
test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x2c): undefined reference to `arrow::util::detail::StringStreamWrapper::StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x65): undefined reference to `arrow::util::detail::StringStreamWrapper::str[abi:cxx11]()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x72): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA26_KcEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x97): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::Status arrow::Status::FromArgs<char const (&) [37], long, char const (&) [17], char const (&) [7], long const&>(arrow::StatusCode, char const (&) [37], long&&, char const (&) [17], char const (&) [7], long const&)':
test.cpp:(.text._ZN5arrow6Status8FromArgsIJRA37_KclRA17_S2_RA7_S2_RKlEEES0_NS_10StatusCodeEDpOT_[_ZN5arrow6Status8FromArgsIJRA37_KclRA17_S2_RA7_S2_RKlEEES0_NS_10StatusCodeEDpOT_]+0xbe): undefined reference to `arrow::Status::Status(arrow::StatusCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > arrow::util::StringBuilder<char const (&) [37], long, char const (&) [17], char const (&) [7], long const&>(char const (&) [37], long&&, char const (&) [17], char const (&) [7], long const&)':
test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x44): undefined reference to `arrow::util::detail::StringStreamWrapper::StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0xc5): undefined reference to `arrow::util::detail::StringStreamWrapper::str[abi:cxx11]()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0xd2): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA37_KclRA17_S2_RA7_S2_RKlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0xf7): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `void __gnu_cxx::new_allocator<arrow::Schema>::construct<arrow::Schema, std::vector<std::shared_ptr<arrow::Field>, std::allocator<std::shared_ptr<arrow::Field> > >&>(arrow::Schema*, std::vector<std::shared_ptr<arrow::Field>, std::allocator<std::shared_ptr<arrow::Field> > >&)':
test.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN5arrow6SchemaEE9constructIS2_JRSt6vectorISt10shared_ptrINS1_5FieldEESaIS8_EEEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN5arrow6SchemaEE9constructIS2_JRSt6vectorISt10shared_ptrINS1_5FieldEESaIS8_EEEEEvPT_DpOT0_]+0x70): undefined reference to `arrow::Schema::Schema(std::vector<std::shared_ptr<arrow::Field>, std::allocator<std::shared_ptr<arrow::Field> > > const&, std::shared_ptr<arrow::KeyValueMetadata const> const&)'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTVN5arrow12BaseListTypeE[_ZTVN5arrow12BaseListTypeE]+0x20): undefined reference to `arrow::DataType::ComputeFingerprint[abi:cxx11]() const'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTVN5arrow12BaseListTypeE[_ZTVN5arrow12BaseListTypeE]+0x28): undefined reference to `arrow::DataType::ComputeMetadataFingerprint[abi:cxx11]() const'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTVN5arrow10NestedTypeE[_ZTVN5arrow10NestedTypeE]+0x20): undefined reference to `arrow::DataType::ComputeFingerprint[abi:cxx11]() const'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTVN5arrow10NestedTypeE[_ZTVN5arrow10NestedTypeE]+0x28): undefined reference to `arrow::DataType::ComputeMetadataFingerprint[abi:cxx11]() const'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTIN5arrow14NumericBuilderINS_10DoubleTypeEEE[_ZTIN5arrow14NumericBuilderINS_10DoubleTypeEEE]+0x10): undefined reference to `typeinfo for arrow::ArrayBuilder'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTIN5arrow14NumericBuilderINS_9Int64TypeEEE[_ZTIN5arrow14NumericBuilderINS_9Int64TypeEEE]+0x10): undefined reference to `typeinfo for arrow::ArrayBuilder'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTIN5arrow15BaseListBuilderINS_8ListTypeEEE[_ZTIN5arrow15BaseListBuilderINS_8ListTypeEEE]+0x10): undefined reference to `typeinfo for arrow::ArrayBuilder'
/usr/bin/ld: /tmp/ccvG1aV8.o:(.data.rel.ro._ZTIN5arrow10NestedTypeE[_ZTIN5arrow10NestedTypeE]+0x18): undefined reference to `typeinfo for arrow::DataType'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::DoubleType>::Resize(long)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_10DoubleTypeEE6ResizeEl[_ZN5arrow14NumericBuilderINS_10DoubleTypeEE6ResizeEl]+0x16a): undefined reference to `arrow::ArrayBuilder::Resize(long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::DoubleType>::AppendNulls(long)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_10DoubleTypeEE11AppendNullsEl[_ZN5arrow14NumericBuilderINS_10DoubleTypeEE11AppendNullsEl]+0xd7): undefined reference to `arrow::ArrayBuilder::UnsafeSetNull(long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::DoubleType>::FinishInternal(std::shared_ptr<arrow::ArrayData>*)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_10DoubleTypeEE14FinishInternalEPSt10shared_ptrINS_9ArrayDataEE[_ZN5arrow14NumericBuilderINS_10DoubleTypeEE14FinishInternalEPSt10shared_ptrINS_9ArrayDataEE]+0x266): undefined reference to `arrow::ArrayData::Make(std::shared_ptr<arrow::DataType> const&, long, std::vector<std::shared_ptr<arrow::Buffer>, std::allocator<std::shared_ptr<arrow::Buffer> > >&&, long, long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::Int64Type>::Resize(long)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_9Int64TypeEE6ResizeEl[_ZN5arrow14NumericBuilderINS_9Int64TypeEE6ResizeEl]+0x16a): undefined reference to `arrow::ArrayBuilder::Resize(long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::Int64Type>::AppendNulls(long)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_9Int64TypeEE11AppendNullsEl[_ZN5arrow14NumericBuilderINS_9Int64TypeEE11AppendNullsEl]+0xd8): undefined reference to `arrow::ArrayBuilder::UnsafeSetNull(long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::NumericBuilder<arrow::Int64Type>::FinishInternal(std::shared_ptr<arrow::ArrayData>*)':
test.cpp:(.text._ZN5arrow14NumericBuilderINS_9Int64TypeEE14FinishInternalEPSt10shared_ptrINS_9ArrayDataEE[_ZN5arrow14NumericBuilderINS_9Int64TypeEE14FinishInternalEPSt10shared_ptrINS_9ArrayDataEE]+0x266): undefined reference to `arrow::ArrayData::Make(std::shared_ptr<arrow::DataType> const&, long, std::vector<std::shared_ptr<arrow::Buffer>, std::allocator<std::shared_ptr<arrow::Buffer> > >&&, long, long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BaseListBuilder<arrow::ListType>::Resize(long)':
test.cpp:(.text._ZN5arrow15BaseListBuilderINS_8ListTypeEE6ResizeEl[_ZN5arrow15BaseListBuilderINS_8ListTypeEE6ResizeEl]+0x19a): undefined reference to `arrow::ArrayBuilder::Resize(long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BaseListBuilder<arrow::ListType>::Reset()':
test.cpp:(.text._ZN5arrow15BaseListBuilderINS_8ListTypeEE5ResetEv[_ZN5arrow15BaseListBuilderINS_8ListTypeEE5ResetEv]+0x18): undefined reference to `arrow::ArrayBuilder::Reset()'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BaseListBuilder<arrow::ListType>::FinishInternal(std::shared_ptr<arrow::ArrayData>*)':
test.cpp:(.text._ZN5arrow15BaseListBuilderINS_8ListTypeEE14FinishInternalEPSt10shared_ptrINS_9ArrayDataEE[_ZN5arrow15BaseListBuilderINS_8ListTypeEE14FinishInternalEPSt10shared_ptrINS_9ArrayDataEE]+0x568): undefined reference to `arrow::ArrayData::Make(std::shared_ptr<arrow::DataType> const&, long, std::vector<std::shared_ptr<arrow::Buffer>, std::allocator<std::shared_ptr<arrow::Buffer> > > const&, std::vector<std::shared_ptr<arrow::ArrayData>, std::allocator<std::shared_ptr<arrow::ArrayData> > > const&, long, long)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::BaseListBuilder<arrow::ListType>::type() const':
test.cpp:(.text._ZNK5arrow15BaseListBuilderINS_8ListTypeEE4typeEv[_ZNK5arrow15BaseListBuilderINS_8ListTypeEE4typeEv]+0x70): undefined reference to `arrow::Field::WithType(std::shared_ptr<arrow::DataType> const&) const'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `arrow::Status arrow::Status::FromArgs<char const (&) [47], long, char const (&) [6], long&>(arrow::StatusCode, char const (&) [47], long&&, char const (&) [6], long&)':
test.cpp:(.text._ZN5arrow6Status8FromArgsIJRA47_KclRA6_S2_RlEEES0_NS_10StatusCodeEDpOT_[_ZN5arrow6Status8FromArgsIJRA47_KclRA6_S2_RlEEES0_NS_10StatusCodeEDpOT_]+0x9c): undefined reference to `arrow::Status::Status(arrow::StatusCode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /tmp/ccvG1aV8.o: in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > arrow::util::StringBuilder<char const (&) [47], long, char const (&) [6], long&>(char const (&) [47], long&&, char const (&) [6], long&)':
test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0x3e): undefined reference to `arrow::util::detail::StringStreamWrapper::StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0xad): undefined reference to `arrow::util::detail::StringStreamWrapper::str[abi:cxx11]()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0xba): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
/usr/bin/ld: test.cpp:(.text._ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_[_ZN5arrow4util13StringBuilderIJRA47_KclRA6_S2_RlEEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEDpOT_]+0xdf): undefined reference to `arrow::util::detail::StringStreamWrapper::~StringStreamWrapper()'
collect2: error: ld returned 1 exit status
The code compiles correctly but fails to link. You need to supply the arrow library also to the g++ command:
g++ -L<directoy-of-libarrow.so> -larrow test.cpp
e.g.
g++ -L/usr/local/lib -larrow test.cpp
First step: make a file named
CMakeLists.txt
Second step: Paste the following text to the CMakeLists.txt file
cmake_minimum_required(VERSION 3.0)
project(test)
find_package(Arrow REQUIRED)
add_executable(test.o test.cpp)
target_link_libraries(test.o PRIVATE arrow_shared)
Third step:
cmake .
make
Fourth step (execute the test project):
./test.o
I am cross-compiling OpenCV libraries (2.4.9) and Raspicam (0.1.3) in Eclipse CDT IDE for Raspberry Pi. I am trying to compile a basic application that looks as the following:
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <raspicam.h>
#include <raspicam_cv.h>
using namespace std;
using namespace cv;
int main()
{
....
namedWindow(output_window_name, CV_WINDOW_AUTOSIZE);
namedWindow(grayscale_window_name, 100);
namedWindow(thresholded_window_name, 100);
namedWindow(contours_window_name, 100);
moveWindow(grayscale_window_name, 20,20);
moveWindow(thresholded_window_name, 20, 250);
moveWindow(contours_window_name, 20, 600);
vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
compression_params.push_back(100);
raspicam::RaspiCam_Cv Camera;
....
}
To compile I made sure that libopencv_*.so files are in the cross compilation sysroot and linked in Eclipse using -l flags such as -lopencv_core -lopencv_highgui etc. I also included every include/ folder in sources using -I flag in Eclipse Build Settings.
Inclusion using #include and namespace declarations do not result in any errors.
Target building looks like this in the console:
arm-linux-gnueabihf-g++
-L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\usr\lib"
-L"C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf"
-L"C:\rpi-eclipse\workspace\RaspberryTest\libbluetooth"
-L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\lib"
-Wl,-rpath-link,"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\lib\arm-linux-gnueabihf"
-o "RaspberryTest" ./src/<ALL OBJS>
-lwiringPi
-lopencv_calib3d
-lopencv_core
-lopencv_features2d
-lopencv_flann
-lopencv_highgui
-lopencv_imgproc
-lopencv_ml
-lopencv_objdetect
-lopencv_video
-lbluetooth
-lpthread
-lwiringPiDev
However, the following errors are there:
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:115: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:116: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:117: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:118: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:120: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:121: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:122: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:129: undefined reference to `raspicam::RaspiCam_Cv::RaspiCam_Cv()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:131: undefined reference to `raspicam::RaspiCam_Cv::open()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:194: undefined reference to `raspicam::RaspiCam_Cv::grab()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:195: undefined reference to `raspicam::RaspiCam_Cv::retrieve(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:208: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:208: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:211: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:211: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:215: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:215: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:219: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:219: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:224: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:224: undefined reference to `cv::floodFill(cv::_OutputArray const&, cv::Point_<int>, cv::Scalar_<double>, cv::Rect_<int>*, cv::Scalar_<double>, cv::Scalar_<double>, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:228: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:228: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:233: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:233: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:238: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:238: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:240: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:240: undefined reference to `cv::findContours(cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:129: undefined reference to `raspicam::RaspiCam_Cv::~RaspiCam_Cv()'
./src/tasks/image_processing_task.o: In function `cv::Mat::clone() const':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:335: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray(cv::Scalar_<double> const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1137: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Point_<int> >(std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1145: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Vec<int, 4> >(std::vector<cv::Vec<int, 4>, std::allocator<cv::Vec<int, 4> > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1143: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Point_<int> >(std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1122: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Point_<int> >(std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1143: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Point_<int> >(std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1125: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Vec<int, 4> >(std::vector<cv::Vec<int, 4>, std::allocator<cv::Vec<int, 4> > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1122: undefined reference to `vtable for cv::_InputArray'
collect2.exe: error: ld returned 1 exit status
make: *** [RaspberryTest] Error 1
This indicates that I have two type of errors.
1-) undefined reference (for functions)
2-) undefined reference to vtable` (Related to virtual functions I believe)
In order to overcome this problem, I feel like I have to change STL/C standards, but do not know what to do exactly. Also, the fact that libraries are compiled and included correctly but there are still undefined references is really weird to me.
Any guidance regarding how to solve this problem is greately appreciated.
Thanks in advance.
What are the ways to run apache qpid c++ helloworld example without make and by using g++ i need to create an helloworld.o object file how to do these?
g++ -I ./includes/ -o m hello_world.cpp
/tmp/cc9Jao8f.o: In function `main':
hello_world.cpp:(.text+0x169): undefined reference to `qpid::messaging::Connection::Connection(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x178): undefined reference to `qpid::messaging::Connection::open()'
hello_world.cpp:(.text+0x1a1): undefined reference to `qpid::messaging::Connection::createSession(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x1e8): undefined reference to `qpid::messaging::Session::createReceiver(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x205): undefined reference to `qpid::messaging::Session::createSender(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x239): undefined reference to `qpid::messaging::Message::Message(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
hello_world.cpp:(.text+0x254): undefined reference to `qpid::messaging::Sender::send(qpid::messaging::Message const&, bool)'
hello_world.cpp:(.text+0x267): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x27b): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x2d6): undefined reference to `qpid::messaging::Duration::SECOND'
hello_world.cpp:(.text+0x2db): undefined reference to `qpid::messaging::operator*(qpid::messaging::Duration const&, unsigned long)'
hello_world.cpp:(.text+0x2f7): undefined reference to `qpid::messaging::Receiver::fetch(qpid::messaging::Duration)'
hello_world.cpp:(.text+0x30d): undefined reference to `qpid::messaging::Message::getContent() const'
hello_world.cpp:(.text+0x366): undefined reference to `qpid::messaging::Session::acknowledge(bool)'
hello_world.cpp:(.text+0x375): undefined reference to `qpid::messaging::Connection::close()'
hello_world.cpp:(.text+0x389): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x39f): undefined reference to `qpid::messaging::Message::~Message()'
hello_world.cpp:(.text+0x3bb): undefined reference to `qpid::messaging::Sender::~Sender()'
hello_world.cpp:(.text+0x3d2): undefined reference to `qpid::messaging::Sender::~Sender()'
hello_world.cpp:(.text+0x3e8): undefined reference to `qpid::messaging::Receiver::~Receiver()'
hello_world.cpp:(.text+0x3ff): undefined reference to `qpid::messaging::Receiver::~Receiver()'
hello_world.cpp:(.text+0x415): undefined reference to `qpid::messaging::Session::~Session()'
hello_world.cpp:(.text+0x42c): undefined reference to `qpid::messaging::Session::~Session()'
hello_world.cpp:(.text+0x483): undefined reference to `qpid::messaging::Connection::close()'
hello_world.cpp:(.text+0x4b5): undefined reference to `qpid::messaging::Connection::~Connection()'
hello_world.cpp:(.text+0x4cc): undefined reference to `qpid::messaging::Connection::~Connection()'
collect2: ld returned 1 exit status
You just need to link against the library. If the library is called libqpid.so for example, you would add -lqpid to your build command.