Error including dlib library in c++ project - c++

I need to include dlib in a c++ project. I have properly linked the library in my Makefile. Here is the Makefile:
EXE = face_frontalization
OBJ_DIR = bin
CFLAGS = -g -w
# CXXFLAGS = -w -Wall -Wextra -g -std=c++0x
# LDFLAGS = -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lSDL2_gfx -lm
dummy_build_folder := $(shell mkdir -p $(OBJ_DIR))
# c++ source files of the project
CXXFILES = $(shell find src -type f -name '*.cpp')
CXXOBJ = $(patsubst src/%.cpp,bin/%.o,$(CXXFILES))
INCLUDE = -I/usr/include/dlib-18.18
LIBS = `pkg-config --libs opencv`
CXXFLAGS = `pkg-config --cflags opencv` -w -Wall -Wextra -g -std=c++0x
LDFLAGS = -lcurl
CFLAGS = `pkg-config --cflags opencv` -g -w
MKDIR = mkdir -p
ifdef V
MUTE =
VTAG = -v
else
MUTE = #
endif
###################################################################
# This is a Makefile progress indicator.
# BUILD is initially undefined
ifndef BUILD
# max equals 256 x's
sixteen := x x x x x x x x x x x x x x x x
MAX := $(foreach x,$(sixteen),$(sixteen))
# T estimates how many targets we are building by replacing BUILD with
# a special string
T := $(shell $(MAKE) -nrRf $(firstword $(MAKEFILE_LIST)) $(MAKECMDGOALS) \
BUILD="COUNTTHIS" | grep -c "COUNTTHIS")
# N is the number of pending targets in base 1, well in fact, base x
# :-)
N := $(wordlist 1,$T,$(MAX))
# auto-decrementing counter that returns the number of pending targets
# in base 10
counter = $(words $N)$(eval N := $(wordlist 2,$(words $N),$N))
# BUILD is now defined to show the progress, this also avoids
# redefining T in loop
BUILD = #echo $(counter) of $(T)
endif
###################################################################
# .PHONY: directories all
#
# directories: ${OUT_DIR}
# ${OUT_DIR}:
# ${MKDIR} ${OUT_DIR}
all: $(EXE)
# build successful
$(EXE): $(CXXOBJ)
$(CXX) $(CXXOBJ) -o $(EXE) $(LIBS) $(LDFLAGS)
$(OBJ_DIR)/%.o: src/%.cpp
$(CXX) $(CXXFLAGS) $(INCLUDE) $< -c -o $#
$(BUILD)
$(OBJ_DIR)/%.o: src/%.c
$(CC) $(CFLAGS) $(INCLUDE) $< -c -o $#
run: all
./$(EXE)
clean:
# Cleaning...
-rm -f $(EXE) $(CXXOBJ)
rmdir bin/
I dont know why but its giving errors on compilation. I have compiled the dlib library itself too and the code examples are running as they should.
The error I am getting is:
bin/fatialfeaturedetect.o: In function `fatial_feature_detector()':
/home/playroom/Desktop/face-frontalization/src/fatialfeaturedetect.cpp:20: undefined reference to `dlib::base_window::wait_until_closed() const'
/home/playroom/Desktop/face-frontalization/src/fatialfeaturedetect.cpp:18: undefined reference to `dlib::image_window::~image_window()'
/home/playroom/Desktop/face-frontalization/src/fatialfeaturedetect.cpp:18: undefined reference to `dlib::image_window::~image_window()'
bin/fatialfeaturedetect.o: In function `dlib::get_serialized_frontal_faces()':
/usr/include/dlib-18.18/dlib/image_processing/frontal_face_detector.h:115: undefined reference to `dlib::base64::base64()'
/usr/include/dlib-18.18/dlib/image_processing/frontal_face_detector.h:2358: undefined reference to `dlib::base64::decode(std::istream&, std::ostream&) const'
/usr/include/dlib-18.18/dlib/image_processing/frontal_face_detector.h:2367: undefined reference to `dlib::base64::~base64()'
/usr/include/dlib-18.18/dlib/image_processing/frontal_face_detector.h:2367: undefined reference to `dlib::base64::~base64()'
bin/fatialfeaturedetect.o: In function `dlib_check_consistent_assert_usage':
/usr/include/dlib-18.18/dlib/gui_widgets/../gui_core/../threads/threads_kernel_shared.h:44: undefined reference to `USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives_'
bin/fatialfeaturedetect.o: In function `dlib::drawable_window::drawable_window(bool, bool)':
/usr/include/dlib-18.18/dlib/gui_widgets/drawable.h:79: undefined reference to `dlib::base_window::base_window(bool, bool)'
/usr/include/dlib-18.18/dlib/gui_widgets/drawable.h:79: undefined reference to `vtable for dlib::drawable_window'
/usr/include/dlib-18.18/dlib/gui_widgets/drawable.h:79: undefined reference to `dlib::base_window::~base_window()'
bin/fatialfeaturedetect.o: In function `dlib::drawable_window::~drawable_window()':
/usr/include/dlib-18.18/dlib/gui_widgets/drawable.h:195: undefined reference to `vtable for dlib::drawable_window'
/usr/include/dlib-18.18/dlib/gui_widgets/drawable.h:195: undefined reference to `dlib::base_window::close_window()'
/usr/include/dlib-18.18/dlib/gui_widgets/drawable.h:195: undefined reference to `dlib::base_window::~base_window()'
bin/fatialfeaturedetect.o: In function `dlib::scrollable_region_style_default::draw_scrollable_region_border(dlib::canvas const&, dlib::rectangle const&, bool) const':
/usr/include/dlib-18.18/dlib/gui_widgets/style.h:527: undefined reference to `dlib::draw_sunken_rectangle(dlib::canvas const&, dlib::rectangle const&, unsigned char)'
bin/fatialfeaturedetect.o: In function `dlib::image_display::disable_overlay_editing()':
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3485: undefined reference to `dlib::base_window::invalidate_rectangle(dlib::rectangle const&)'
bin/fatialfeaturedetect.o: In function `dlib::compress_stream_kernel_1<dlib::entropy_encoder_model_kernel_5<257ul, dlib::entropy_encoder_kernel_2, 200000ul, 4ul>, dlib::entropy_decoder_model_kernel_5<257ul, dlib::entropy_decoder_kernel_2, 200000ul, 4ul>, dlib::crc32>::decompress(std::istream&, std::ostream&) const':
/usr/include/dlib-18.18/dlib/image_processing/../compress_stream/compress_stream_kernel_1.h:180: undefined reference to `dlib::entropy_decoder_kernel_2::entropy_decoder_kernel_2()'
/usr/include/dlib-18.18/dlib/image_processing/../compress_stream/compress_stream_kernel_1.h:181: undefined reference to `dlib::entropy_decoder_kernel_2::set_stream(std::istream&)'
/usr/include/dlib-18.18/dlib/image_processing/../compress_stream/compress_stream_kernel_1.h:196: undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../compress_stream/compress_stream_kernel_1.h:201: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../compress_stream/compress_stream_kernel_1.h:243: undefined reference to `dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2()'
/usr/include/dlib-18.18/dlib/image_processing/../compress_stream/compress_stream_kernel_1.h:243: undefined reference to `dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2()'
bin/fatialfeaturedetect.o: In function `void dlib::image_window::add_overlay<dlib::rgb_pixel>(std::vector<dlib::rectangle, std::allocator<dlib::rectangle> > const&, dlib::rgb_pixel)':
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3968: undefined reference to `dlib::image_window::add_overlay(std::vector<dlib::image_display::overlay_rect, std::allocator<dlib::image_display::overlay_rect> > const&)'
bin/fatialfeaturedetect.o: In function `dlib::image_window::image_window<dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> > >(dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> > const&)':
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3883: undefined reference to `vtable for dlib::image_window'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3883: undefined reference to `dlib::image_display::image_display(dlib::drawable_window&)'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3885: undefined reference to `dlib::image_window::on_image_clicked(dlib::vector<long, 2l> const&, bool, unsigned long)'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3888: undefined reference to `dlib::base_window::show()'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3883: undefined reference to `dlib::image_display::~image_display()'
bin/fatialfeaturedetect.o: In function `dlib::entropy_decoder_model_kernel_5<257ul, dlib::entropy_decoder_kernel_2, 200000ul, 4ul>::decode(unsigned long&)':
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:422: undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:456: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:503: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:551: undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:553: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
bin/fatialfeaturedetect.o: In function `void dlib::image_window::set_image<dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> > >(dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> > const&)':
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3930: undefined reference to `dlib::image_display::get_image_display_rect() const'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3934: undefined reference to `dlib::base_window::set_size(int, int)'
bin/fatialfeaturedetect.o: In function `void dlib::load_dng<dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> > >(dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> >&, std::istream&)':
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:585: undefined reference to `dlib::entropy_decoder_kernel_2::entropy_decoder_kernel_2()'
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:586: undefined reference to `dlib::entropy_decoder_kernel_2::set_stream(std::istream&)'
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:757: undefined reference to `dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2()'
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:771: undefined reference to `dlib::entropy_decoder_kernel_2::entropy_decoder_kernel_2()'
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:772: undefined reference to `dlib::entropy_decoder_kernel_2::set_stream(std::istream&)'
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:771: undefined reference to `dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2()'
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:757: undefined reference to `dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2()'
/usr/include/dlib-18.18/dlib/image_loader/image_loader.h:771: undefined reference to `dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2()'
bin/fatialfeaturedetect.o: In function `void dlib::image_display::set_image<dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> > >(dlib::array2d<dlib::rgb_pixel, dlib::memory_manager_stateless_kernel_1<char> > const&)':
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3272: undefined reference to `dlib::scrollable_region::set_total_rect_size(unsigned long, unsigned long)'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3274: undefined reference to `dlib::scrollable_region::set_total_rect_size(unsigned long, unsigned long)'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3278: undefined reference to `dlib::base_window::invalidate_rectangle(dlib::rectangle const&)'
/usr/include/dlib-18.18/dlib/gui_widgets/widgets.h:3283: undefined reference to `dlib::popup_menu_region::disable()'
bin/fatialfeaturedetect.o: In function `dlib::entropy_decoder_model_kernel_5<256ul, dlib::entropy_decoder_kernel_2, 200000ul, 4ul>::decode(unsigned long&)':
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:422: undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:456: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:503: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:551: undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_5.h:553: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
bin/fatialfeaturedetect.o: In function `dlib::entropy_decoder_model_kernel_4<256ul, dlib::entropy_decoder_kernel_2, 200000ul, 4ul>::decode(unsigned long&)':
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_4.h:348: undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_4.h:376: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_4.h:422: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_4.h:469: undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
/usr/include/dlib-18.18/dlib/image_processing/../entropy_decoder_model/entropy_decoder_model_kernel_4.h:471: undefined reference to `dlib::entropy_decoder_kernel_2::decode(unsigned int, unsigned int)'
collect2: error: ld returned 1 exit status
make: *** [face_frontalization] Error 1
I cant figure out what I have done in linking the library to the project. Please help.

Dlib is partially header-based and some functions need to have libdlib.a linked to a project
You have two ways how to solve your problem:
link to dlib: LDFLAGS = -ldlib (dlib should be installed or its path provided to linker)
add dlib/all/source.cpp to your project sources list(CXXFILES)

If this error is present during compilation with dLib:
/usr/bin/ld: /tmp/ccps6CPH.o: undefined reference to symbol 'pthread_create##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status make: *** [face_frontalization] Error 1
There is a good probability that X11 is missing. I dont know what it is so if somebody does, please tell me. Solution is to just add -lX11 to the LDFLAGS in order to link with it. If you dont want it, you can also specify compiler option -DDLIB_NO_GUI_SUPPORT.
(NOTE: I haven't tested it and dont know what X11 does so better include it than exclude it.)

Related

How to fix multiple definition of main building gtest project using make on ubuntu [duplicate]

This question already has an answer here:
Linking issue with GCC 4.6.1
(1 answer)
Closed 1 year ago.
I wanted to build a gtest project on linux using just a makefile, ie not using cmake. I followed along the tutorial here:
http://www.yolinux.com/TUTORIALS/Cpp-GoogleTest.html
But getting multiple definition of main errors - see below.
I am on ubuntu v20.04
angus#angus-VirtualBox:~/Documents/code/gtest_make_only/test/src$ uname -a
Linux angus-VirtualBox 5.11.0-38-generic #42~20.04.1-Ubuntu SMP Tue Sep 28 20:41:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I installed gtest like this:
git clone https://github.com/google/googletest.git
mkdir build
cd build
sudo snap install cmake --classic
cmake .. -DBUILD_GMOCK=OFF
make
sudo make install
If I now look on my system I have
/usr/local/include - with gtest directory with header files
/usr/local/lib - contains libgtest.a and libgtest_main.a
I modified the Makefile in the example to be like this:
CXX = g++
CXXFLAGS = -g -L/usr/local/lib -lgtest -lgtest_main -lpthread
INCS = -I./ -I../../src -I/usr/local/include
OBJS = ../../src/Addition.o Addition_Test.o ../../src/Multiply.o Multiply_Test.o
testAll: $(OBJS)
$(CXX) $(CXXFLAGS) $(INCS) -o testAll Main_TestAll.cpp $(OBJS)
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $# $(INCS)
clean:
rm testAll *.o testAll.xml
I also had to tidy up the code sample - eg where in code has Addition.h - have to change to Addition.hpp which is the filename.
The build error below. How to fix this?
I did try by removing -lgtest_main from the Makefile, but then get error:
/home/angus/Documents/code/gtest_make_only/test/src/Main_TestAll.cpp:5: undefined reference to `testing::InitGoogleTest(int*, char**)'
build error:
angus#angus-VirtualBox:~/Documents/code/gtest_make_only/test/src$ make
g++ -g -L/usr/local/lib -lgtest -lgtest_main -lpthread -c Multiply_Test.cpp -o Multiply_Test.o -I./ -I../../src -I/usr/local/include
g++ -g -L/usr/local/lib -lgtest -lgtest_main -lpthread -I./ -I../../src -I/usr/local/include -o testAll Main_TestAll.cpp ../../src/Addition.o Addition_Test.o ../../src/Multiply.o Multiply_Test.o
/usr/bin/ld: /tmp/cc4xkhF1.o: in function `RUN_ALL_TESTS()':
/home/angus/Documents/code/gtest_make_only/test/src/Main_TestAll.cpp:4: multiple definition of `main'; /usr/local/lib/libgtest_main.a(gtest_main.cc.o):gtest_main.cc:(.text+0x0): first defined here
/usr/bin/ld: /usr/local/lib/libgtest_main.a(gtest_main.cc.o): in function `main':
gtest_main.cc:(.text+0x3a): undefined reference to `testing::InitGoogleTest(int*, char**)'
/usr/bin/ld: /usr/local/lib/libgtest_main.a(gtest_main.cc.o): in function `RUN_ALL_TESTS()':
gtest_main.cc:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0x9): undefined reference to `testing::UnitTest::GetInstance()'
/usr/bin/ld: gtest_main.cc:(.text._Z13RUN_ALL_TESTSv[_Z13RUN_ALL_TESTSv]+0x11): undefined reference to `testing::UnitTest::Run()'
/usr/bin/ld: /tmp/cc4xkhF1.o: in function `main':
/home/angus/Documents/code/gtest_make_only/test/src/Main_TestAll.cpp:5: undefined reference to `testing::InitGoogleTest(int*, char**)'
/usr/bin/ld: Addition_Test.o: in function `AdditionTest_twoValues_Test::TestBody()':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:20: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:21: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: Addition_Test.o: in function `__static_initialization_and_destruction_0(int, int)':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:16: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: Addition_Test.o: in function `testing::internal::SuiteApiResolver<AdditionTest>::GetSetUpCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Addition_Test.o: in function `testing::internal::SuiteApiResolver<AdditionTest>::GetTearDownCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Addition_Test.o: in function `testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&)':
/usr/local/include/gtest/gtest.h:1549: undefined reference to `testing::AssertionSuccess()'
/usr/bin/ld: Addition_Test.o: in function `testing::AssertionResult testing::internal::CmpHelperEQFailure<int, int>(char const*, char const*, int const&, int const&)':
/usr/local/include/gtest/gtest.h:1532: undefined reference to `testing::internal::EqFailure(char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: Addition_Test.o: in function `AdditionTest::~AdditionTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:5: undefined reference to `testing::Test::~Test()'
/usr/bin/ld: Addition_Test.o:(.data.rel.ro._ZTI12AdditionTest[_ZTI12AdditionTest]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: Addition_Test.o: in function `AdditionTest::AdditionTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Addition_Test.cpp:5: undefined reference to `testing::Test::Test()'
/usr/bin/ld: Multiply_Test.o: in function `MultiplyTest_twoValues_Test::TestBody()':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:18: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:19: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: Multiply_Test.o: in function `__static_initialization_and_destruction_0(int, int)':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:14: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: Multiply_Test.o: in function `testing::internal::SuiteApiResolver<MultiplyTest>::GetSetUpCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:527: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Multiply_Test.o: in function `testing::internal::SuiteApiResolver<MultiplyTest>::GetTearDownCaseOrSuite(char const*, int)':
/usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/local/include/gtest/internal/gtest-internal.h:548: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: Multiply_Test.o: in function `MultiplyTest::~MultiplyTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:5: undefined reference to `testing::Test::~Test()'
/usr/bin/ld: Multiply_Test.o:(.data.rel.ro._ZTI12MultiplyTest[_ZTI12MultiplyTest]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: Multiply_Test.o: in function `MultiplyTest::MultiplyTest()':
/home/angus/Documents/code/gtest_make_only/test/src/Multiply_Test.cpp:5: undefined reference to `testing::Test::Test()'
collect2: error: ld returned 1 exit status
make: *** [Makefile:7: testAll] Error 1
Your command lines are all wrong.
Library specification should follow sources and object files. Correct line should look like this:
g++ -g -I./ -I../../src -o testAll Main_TestAll.cpp ../../src/Addition.o Addition_Test.o ../../src/Multiply.o Multiply_Test.o -lgtest_main -lgtest -lpthread
See this blog post for explanation.

Tableau API linker error

This is probably trivial. I'm using Qt with the Tableau C++ api and I am having a bad time trying to get things to link appropriately.
I have the following directory structure.
allenh1#localhost ~/CS/tableau-api/tableau-qt
$ ls
bin include lib64 share src tableau-qt.pro ui
Here's the .pro file
QT += core gui widgets
CONFIG += c++14
TARGET = qt-tableau-demo
TEMPLATE = app
# Link with the Tableau SDK library files
QMAKE_RPATHDIR += lib64/tableausdk
SOURCES += src/main.cpp \
src/TableauTable.cpp
HEADERS += include/TableauTable.hpp
Note: the UI is not implemented yet, but will be after I get this to compile.
When I try to build it, I get the following:
allenh1#localhost ~/CS/tableau-api/tableau-qt
$ make
g++ -c -pipe -O2 -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../../../Qt/5.6/gcc_64/include -I../../../../Qt/5.6/gcc_64/include/QtWidgets -I../../../../Qt/5.6/gcc_64/include/QtGui -I../../../../Qt/5.6/gcc_64/include/QtCore -I. -I../../../../Qt/5.6/gcc_64/mkspecs/linux-g++ -o main.o src/main.cpp
In file included from src/../include/tableau-sdk/TableauExtract.hpp:18:0,
from src/../include/TableauTable.hpp:3,
from src/main.cpp:2:
src/../include/tableau-sdk/TableauCommon.hpp:144:38: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const TAB_RESULT GetResultCode() const { return m_result; }
^
src/main.cpp:14:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char *argv[])
^
src/main.cpp:14:31: warning: unused parameter 'argv' [-Wunused-parameter]
int main(int argc, char *argv[])
^
g++ -c -pipe -O2 -std=gnu++1y -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../../../Qt/5.6/gcc_64/include -I../../../../Qt/5.6/gcc_64/include/QtWidgets -I../../../../Qt/5.6/gcc_64/include/QtGui -I../../../../Qt/5.6/gcc_64/include/QtCore -I. -I../../../../Qt/5.6/gcc_64/mkspecs/linux-g++ -o TableauTable.o src/TableauTable.cpp
In file included from src/../include/tableau-sdk/TableauExtract.hpp:18:0,
from src/../include/TableauTable.hpp:3,
from src/TableauTable.cpp:1:
src/../include/tableau-sdk/TableauCommon.hpp:144:38: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
const TAB_RESULT GetResultCode() const { return m_result; }
^
g++ -Wl,-O1 -Wl,-z,origin -Wl,-rpath,\$ORIGIN/lib64/tableausdk -Wl,-rpath,/home/allenh1/Qt/5.6/gcc_64/lib -o perscio-tableau-demo main.o TableauTable.o -L/home/allenh1/Qt/5.6/gcc_64/lib -lQt5Widgets -L/usr/lib64 -lQt5Gui -lQt5Core -lGL -lpthread
main.o: In function `fill_table(TableauTable*&)':
main.cpp:(.text+0x88): undefined reference to `bool TableauTable::add_column<std::type_info const&>(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::type_info const&)'
main.cpp:(.text+0xc6): undefined reference to `bool TableauTable::add_column<std::type_info const&>(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::type_info const&)'
main.cpp:(.text+0xfd): undefined reference to `bool TableauTable::add_column<std::type_info const&>(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&, std::type_info const&)'
TableauTable.o: In function `Tableau::(anonymous namespace)::MakeTableauString(wchar_t const*)':
TableauTable.cpp:(.text+0x48): undefined reference to `ToTableauString'
TableauTable.o: In function `TableauTable::TableauTable()':
TableauTable.cpp:(.text+0x1b0): undefined reference to `TabTableDefinitionCreate'
TableauTable.cpp:(.text+0x1ba): undefined reference to `TAB_RESULT_Success'
TableauTable.cpp:(.text+0x1ef): undefined reference to `TabTableDefinitionSetDefaultCollation'
TableauTable.cpp:(.text+0x22d): undefined reference to `TabGetLastErrorMessage'
TableauTable.cpp:(.text+0x2a7): undefined reference to `TabGetLastErrorMessage'
TableauTable.o: In function `TableauTable::init(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >)':
TableauTable.cpp:(.text+0x42b): undefined reference to `TabExtractAPIInitialize'
TableauTable.cpp:(.text+0x434): undefined reference to `TAB_RESULT_Success'
TableauTable.cpp:(.text+0x47f): undefined reference to `TabExtractCreate'
TableauTable.cpp:(.text+0x509): undefined reference to `TabExtractHasTable'
TableauTable.cpp:(.text+0x5ff): undefined reference to `TabTableDefinitionCreate'
TableauTable.cpp:(.text+0x65f): undefined reference to `TabExtractAddTable'
TableauTable.cpp:(.text+0x721): undefined reference to `TabTableDefinitionClose'
TableauTable.cpp:(.text+0x74b): undefined reference to `TabGetLastErrorMessage'
TableauTable.cpp:(.text+0x7f7): undefined reference to `TabExtractOpenTable'
TableauTable.cpp:(.text+0x8b9): undefined reference to `TabTableGetTableDefinition'
TableauTable.cpp:(.text+0x8c2): undefined reference to `TAB_RESULT_Success'
TableauTable.cpp:(.text+0x8df): undefined reference to `TabTableDefinitionCreate'
TableauTable.cpp:(.text+0xd0e): undefined reference to `TabGetLastErrorMessage'
TableauTable.cpp:(.text+0xe09): undefined reference to `TabGetLastErrorMessage'
TableauTable.cpp:(.text+0xe78): undefined reference to `TabGetLastErrorMessage'
TableauTable.cpp:(.text+0xef7): undefined reference to `TabGetLastErrorMessage'
TableauTable.cpp:(.text+0xf97): undefined reference to `TabGetLastErrorMessage'
TableauTable.o:TableauTable.cpp:(.text+0xffa): more undefined references to `TabGetLastErrorMessage' follow
TableauTable.o: In function `std::_Sp_counted_ptr<Tableau::TableDefinition*, (__gnu_cxx::_Lock_policy)2>::_M_dispose()':
TableauTable.cpp:(.text._ZNSt15_Sp_counted_ptrIPN7Tableau15TableDefinitionELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt15_Sp_counted_ptrIPN7Tableau15TableDefinitionELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x2a): undefined reference to `TabTableDefinitionClose'
TableauTable.cpp:(.text._ZNSt15_Sp_counted_ptrIPN7Tableau15TableDefinitionELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt15_Sp_counted_ptrIPN7Tableau15TableDefinitionELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x33): undefined reference to `TAB_RESULT_Success'
TableauTable.cpp:(.text._ZNSt15_Sp_counted_ptrIPN7Tableau15TableDefinitionELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv[_ZNSt15_Sp_counted_ptrIPN7Tableau15TableDefinitionELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv]+0x76): undefined reference to `TabGetLastErrorMessage'
TableauTable.o: In function `Tableau::TableDefinition::Close()':
TableauTable.cpp:(.text._ZN7Tableau15TableDefinition5CloseEv[_ZN7Tableau15TableDefinition5CloseEv]+0x24): undefined reference to `TabTableDefinitionClose'
TableauTable.cpp:(.text._ZN7Tableau15TableDefinition5CloseEv[_ZN7Tableau15TableDefinition5CloseEv]+0x2d): undefined reference to `TAB_RESULT_Success'
TableauTable.cpp:(.text._ZN7Tableau15TableDefinition5CloseEv[_ZN7Tableau15TableDefinition5CloseEv]+0x68): undefined reference to `TabGetLastErrorMessage'
collect2: error: ld returned 1 exit status
Makefile:200: recipe for target 'qt-tableau-demo' failed
make: *** [qt-tableau-demo] Error 1
The .so files needed (at least to my understanding) are located in the lib64 directory.
allenh1#localhost ~/CS/tableau-api/tableau-qt
$ ls lib64/tableausdk
Java libboost_thread.so libicuuc.so.44
libQt5Core.so.5 libboost_thread.so.1.56.0 libicuuc.so.44.0
libQt5Core.so.5.4.1 libcurl.so libmetrics2.so
libQt5Network.so.5 libcurl.so.4 libtabcrypto.so
libQt5Network.so.5.4.1 libcurl.so.4.4.0 libtabcrypto.so.1.0.0
libTableauCommon.so libexpat.so libtabssl.so
libTableauExtract.so libexpat.so.1 libtabssl.so.1.0.0
libTableauServer.so libexpat.so.1.6.0 libtabsys.so
libboost_chrono.so libicudata.so.44 libtabz.so
libboost_chrono.so.1.56.0 libicudata.so.44.0 libtabz.so.1
libboost_date_time.so libicui18n.so.44 libtabz.so.1.2.8
libboost_date_time.so.1.56.0 libicui18n.so.44.0 libtbb.so.2
libboost_system.so libicuio.so.44 libtbbmalloc.so.2
libboost_system.so.1.56.0 libicuio.so.44.0

error using already compiled version of openCV

I've used the already compiled version of openCV for Raspberry Pi. link for anyone who is interested
After trying to compile using this command line
g++ test3.cpp -o test3 -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lopencv_core -lopencv_highgui -lopencv_imgproc -lwiringPi -lpthread
I get the following error lines.
//usr/local/lib/libopencv_stitching.so.2.4: undefined reference to `cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)'
//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double)'
//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `typeinfo for cv::ParallelLoopBody'
//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::unlock()'
//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::lock()'
//usr/local/lib/libopencv_ocl.so.2.4: undefined reference to cv::TLSDataContainer::getData() const
//usr/local/lib/libopencv_features2d.so.2.4: undefined reference to cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, unsigned char&, bool, unsigned char (cv::Algorithm::)(), void (cv::Algorithm::)(unsigned char), std::basic_string, std::allocator > const&)
//usr/local/lib/libopencv_features2d.so.2.4: undefined reference to `cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, float&, bool, float (cv::Algorithm::)(), void (cv::Algorithm::)(float), std::basic_string, std::allocator > const&)'
//usr/local/lib/libopencv_features2d.so.2.4: undefined reference to `cv::AlgorithmInfo::addParam(cv::Algorithm&, char const*, short&, bool, int (cv::Algorithm::)(), void (cv::Algorithm::)(int), std::basic_string, std::allocator > const&)'
//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::Mutex()'
//usr/local/lib/libopencv_ocl.so.2.4: undefined reference to `cv::TLSDataContainer::TLSDataContainer()'
//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::ParallelLoopBody::~ParallelLoopBody()'
//usr/local/lib/libopencv_calib3d.so.2.4: undefined reference to `cv::Mutex::~Mutex()'
//usr/local/lib/libopencv_ocl.so.2.4: undefined reference to `cv::TLSDataContainer::~TLSDataContainer()'
collect2: ld returned 1 exit status
You have not linked the executable against several libraries that are required by the program
Try using this:
g++ -lpthread `pkg-config opencv --libs` -I/usr/local/include/ -lraspicam -lraspicam_cv -L/opt/vc/lib -lmmal -lmmal_core -lmmal_util -I/usr/include -lwiringPi test3.cpp -o test3

Undefined reference to symbol 'exp##GLIBC_2.2.5' [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 6 years ago.
I am trying to compile Bavieca (for a few weeks now tbh), at the same time becoming accustomed with compiling in Linux, learning about static and dynamic libraries etc, so I'm a little new to this area. Bavieca depends on the BLAS/LAPACK libraries. I am using the atlas respective libraries after unsuccessfully trying the dependent ones.
I can compile successfully the first two parts of the distribution (api & common), but compilation fails in the third (tools).
Makefile:
include ../Makefile.defines
INC = -I./algebra -I./alignment -I./audio -I./base -I./decoding -I./dynamicdecoder -I./estimation -I./config -I./hmm \
-I./io -I./other -I./param -I./text -I./transform -I./wfsadecoder ${INCS_DIR_CBLAS} ${INCS_DIR_LAPACK}
SRC_DIR = ../common
OBJ_DIR = ../../obj/$(ARCH)-$(OS)/common
LIB_DIR = ../../lib/$(ARCH)-$(OS)
OBJFILES_BASE = $(patsubst $(SRC_DIR)/%,$(OBJ_DIR)/%,$(patsubst %.cpp,%.o,$(wildcard $(SRC_DIR)/*/*.cpp)))
static: CPPFLAGS_ = $(CPPFLAGS)
pic: CPPFLAGS_ = $(CPPFLAGS_SHARED)
# targets (pic stands for position independent code)
static: createDirectories libcommon.a
pic: createDirectories libcommon_pic.a
clean:
rm -rf $(OBJ_DIR)
rm -rf $(LIB_DIR)/libcommon.a
rm -rf $(LIB_DIR)/libcommon_pic.a
createDirectories:
(mkdir -p $(LIB_DIR))
(mkdir -p $(OBJ_DIR)/algebra)
(mkdir -p $(OBJ_DIR)/alignment)
(mkdir -p $(OBJ_DIR)/audio)
(mkdir -p $(OBJ_DIR)/base)
(mkdir -p $(OBJ_DIR)/config)
(mkdir -p $(OBJ_DIR)/decoding)
(mkdir -p $(OBJ_DIR)/dynamicdecoder)
(mkdir -p $(OBJ_DIR)/estimation)
(mkdir -p $(OBJ_DIR)/hmm)
(mkdir -p $(OBJ_DIR)/io)
(mkdir -p $(OBJ_DIR)/other)
(mkdir -p $(OBJ_DIR)/param)
(mkdir -p $(OBJ_DIR)/sadmodule)
(mkdir -p $(OBJ_DIR)/text)
(mkdir -p $(OBJ_DIR)/transform)
(mkdir -p $(OBJ_DIR)/vtlestimator)
(mkdir -p $(OBJ_DIR)/wfsabuilder)
(mkdir -p $(OBJ_DIR)/wfsadecoder)
# ----------------------------------------------
# create the static library
#-----------------------------------------------
libcommon.a: $(OBJFILES_BASE)
$(AR) $# $?
(mv libcommon.a $(LIB_DIR))
rm -rf $(OBJ_DIR)
libcommon_pic.a: $(OBJFILES_BASE)
$(AR) $# $?
(mv libcommon_pic.a $(LIB_DIR))
rm -rf $(OBJ_DIR)
# ----------------------------------------------
# create the object files from the source files
# ----------------------------------------------
$(OBJ_DIR)/algebra/%.o: $(SRC_DIR)/algebra/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/alignment/%.o: $(SRC_DIR)/alignment/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/audio/%.o: $(SRC_DIR)/audio/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/base/%.o: $(SRC_DIR)/base/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/config/%.o: $(SRC_DIR)/config/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/decoding/%.o: $(SRC_DIR)/decoding/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/dynamicdecoder/%.o: $(SRC_DIR)/dynamicdecoder/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/estimation/%.o: $(SRC_DIR)/estimation/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/hmm/%.o: $(SRC_DIR)/hmm/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/io/%.o: $(SRC_DIR)/io/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/other/%.o: $(SRC_DIR)/other/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/param/%.o: $(SRC_DIR)/param/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/sadmodule/%.o: $(SRC_DIR)/sadmodule/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/text/%.o: $(SRC_DIR)/text/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/transform/%.o: $(SRC_DIR)/transform/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/vtlestimator/%.o: $(SRC_DIR)/vtlestimator/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/wfsabuilder/%.o: $(SRC_DIR)/wfsabuilder/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
$(OBJ_DIR)/wfsadecoder/%.o: $(SRC_DIR)/wfsadecoder/%.cpp
$(XCC) $(CPPFLAGS_) $(INC) -c $< -o $#
Makefile.defines:
# ---------------------------------------
# Arch and Operating System settings
# ---------------------------------------
MAKE = make --quiet -w
ARCH := $(shell uname -m | sed s/' '//g)
OS := $(shell uname -s)
# ---------------------------------------
# Linux compile options
# ---------------------------------------
XCC = gcc
# SIMD flags (vector based arithmetic operations)
#SIMD_FLAGS =
# SSE is enabled by default on gcc-4.0 and higher. If SSE is enabled, the C preprocessor symbol __SSE__ is defined
SIMD_FLAGS = -msse3
# AVX is available on Sandy Bridge and later Intel and AMD architectures. If AVX is enabled the C preprocessor symbol __AVX__ is defined
#SIMD_FLAGS = -march=corei7-avx
#CPPFLAGS = -g -Wno-deprecated -Wall -O2 -finline-functions $(SIMD_FLAGS)
CPPFLAGS = -g -Wno-deprecated -O2 -finline-functions $(SIMD_FLAGS)
# -fPIC generates Position Independent Code, which is needed to build shared libraries
# so they can be dynamically relocated, however it may slowdown the code, for this reason
# it should be avoided for object files that build executables or static libraries
CPPFLAGS_SHARED = $(CPPFLAGS) -fPIC
AR = ar rs
# ---------------------------------------
# CBLAS and LAPACK includes/libraries
# ---------------------------------------
BASE = /usr
INCS_DIR_CBLAS = -I$(BASE)/include/atlas
INCS_DIR_LAPACK = -I$(BASE)/include/atlas
LIBS_DIR_CBLAS = -L$(BASE)/lib/atlas-base
LIBS_DIR_LAPACK = -L$(BASE)/lib/atlas-base/atlas
LIB_CBLAS = -lcblas -lblas -lgfortran -lf2c
LIB_LAPACK = -llapack
# ----------------------------------------------------
# Java JNI (Java Native Interface) includes/libraries
# ----------------------------------------------------
JAVA_BASE = /usr/lib/jvm/java-1.7.0-openjdk-amd64
INCS_DIR_JNI = -I$(JAVA_BASE)/include -I$(JAVA_BASE)/include/linux
The output is the following:
(mkdir -p ../../obj/x86_64-Linux/tools)
(mkdir -p ../../bin/x86_64-Linux)
gcc -g -Wno-deprecated -O2 -finline-functions -msse3 -L../../lib/x86_64-Linux/ -L/usr/lib/atlas-base -L/usr/lib/atlas-base/atlas -o ../../bin/x86_64-Linux/aligner ../../obj/x86_64-Linux/tools/mainAligner.o -lcommon -llapack -lcblas -lblas -lgfortran -lf2c
/usr/bin/ld: ../../lib/x86_64-Linux//libcommon.a(HMMStateDecoding.o): undefined reference to symbol 'exp##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [aligner] Error 1
Now, I've googled and searched and found out that I need to append -lm to the linker phase. Which I did, resulting in multiple undefined references. This is a small sample of the output in this case:
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `ParameterValue':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/./config/ParameterManager.h:92: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/./config/ParameterManager.h:92: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::_Rb_tree_iterator<std::pair<std::string const, std::string> >::operator++()':
/usr/include/c++/4.8/bits/stl_tree.h:189: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `_Alloc_hider':
/usr/include/c++/4.8/bits/basic_string.h:275: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
/usr/include/c++/4.8/bits/basic_string.h:275: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::operator=(std::string const&)':
/usr/include/c++/4.8/bits/basic_string.h:547: undefined reference to `std::string::assign(std::string const&)'
/usr/include/c++/4.8/bits/basic_string.h:547: undefined reference to `std::string::assign(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `__gnu_cxx::new_allocator<Bavieca::ParameterValue>::deallocate(Bavieca::ParameterValue*, unsigned long)':
/usr/include/c++/4.8/ext/new_allocator.h:110: undefined reference to `operator delete(void*)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `Bavieca::ConfigurationFeatures::load()':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_get_exception_ptr'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `vtable for std::runtime_error'
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `Bavieca::ConfigurationFeatures::load()':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_begin_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:111: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_end_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `__cxa_end_catch'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::exception::~exception()'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `Bavieca::ConfigurationFeatures::load()':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/param/ConfigurationFeatures.cpp:110: undefined reference to `std::terminate()'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `~basic_string':
/usr/include/c++/4.8/bits/basic_string.h:539: undefined reference to `std::string::_Rep::_M_dispose(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o):(.gcc_except_table+0xe4): undefined reference to `typeinfo for std::runtime_error'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o): In function `__static_initialization_and_destruction_0':
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
../../lib/x86_64-Linux//libcommon.a(ConfigurationFeatures.o):(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `Bavieca::AudioFile::load(char const*, int*)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:48: undefined reference to `operator new[](unsigned long)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_get_exception_ptr'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `vtable for std::runtime_error'
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `Bavieca::AudioFile::load(char const*, int*)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_begin_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:54: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:54: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_end_catch'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `std::runtime_error::~runtime_error()'
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `__cxa_end_catch'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `runtime_error':
/usr/include/c++/4.8/stdexcept:112: undefined reference to `std::exception::~exception()'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `Bavieca::AudioFile::load(char const*, int*)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/audio/AudioFile.cpp:53: undefined reference to `std::terminate()'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o):(.gcc_except_table+0x48): undefined reference to `typeinfo for std::runtime_error'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o): In function `__static_initialization_and_destruction_0':
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
../../lib/x86_64-Linux//libcommon.a(AudioFile.o):(.eh_frame+0x53): undefined reference to `__gxx_personality_v0'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:456: undefined reference to `std::ios_base::ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ostream':
/usr/include/c++/4.8/ostream:385: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:456: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ostream':
/usr/include/c++/4.8/ostream:385: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:385: undefined reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ofstream':
/usr/include/c++/4.8/fstream:625: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:625: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:625: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::basic_filebuf()'
/usr/include/c++/4.8/fstream:626: undefined reference to `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `_Alloc_hider':
/usr/include/c++/4.8/bits/basic_string.h:275: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::string::assign(char const*)':
/usr/include/c++/4.8/bits/basic_string.h:1131: undefined reference to `std::string::assign(char const*, unsigned long)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `std::ios_base::~ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_string':
/usr/include/c++/4.8/bits/basic_string.h:539: undefined reference to `std::string::_Rep::_M_dispose(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `Bavieca::FileOutput::FileOutput(char const*, bool)':
/home/spgeo/Desktop/bavieca/bavieca-code/src/common/../common/io/FileOutput.cpp:26: undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::~basic_ofstream()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `basic_ofstream':
/usr/include/c++/4.8/fstream:625: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::~basic_filebuf()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ostream':
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:240: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ofstream':
/usr/include/c++/4.8/fstream:674: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:674: undefined reference to `vtable for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_filebuf':
/usr/include/c++/4.8/fstream:220: undefined reference to `vtable for std::basic_filebuf<char, std::char_traits<char> >'
/usr/include/c++/4.8/fstream:220: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::close()'
/usr/include/c++/4.8/fstream:220: undefined reference to `std::__basic_file<char>::~__basic_file()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_streambuf':
/usr/include/c++/4.8/streambuf:198: undefined reference to `vtable for std::basic_streambuf<char, std::char_traits<char> >'
/usr/include/c++/4.8/streambuf:198: undefined reference to `std::locale::~locale()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ostream':
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `std::ios_base::~ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::string::_Rep::_M_dispose(std::allocator<char> const&)':
/usr/include/c++/4.8/bits/basic_string.h:249: undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_streambuf':
/usr/include/c++/4.8/streambuf:198: undefined reference to `vtable for std::basic_streambuf<char, std::char_traits<char> >'
/usr/include/c++/4.8/streambuf:198: undefined reference to `std::locale::~locale()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ostream':
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
/usr/include/c++/4.8/ostream:93: undefined reference to `VTT for std::basic_ofstream<char, std::char_traits<char> >'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_ios':
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `vtable for std::basic_ios<char, std::char_traits<char> >'
/usr/include/c++/4.8/bits/basic_ios.h:276: undefined reference to `std::ios_base::~ios_base()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `~basic_filebuf':
/usr/include/c++/4.8/fstream:220: undefined reference to `std::__basic_file<char>::~__basic_file()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ofstream<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)':
/usr/include/c++/4.8/fstream:716: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::open(char const*, std::_Ios_Openmode)'
/usr/include/c++/4.8/fstream:721: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_filebuf<char, std::char_traits<char> >::is_open() const':
/usr/include/c++/4.8/fstream:228: undefined reference to `std::__basic_file<char>::is_open() const'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `operator<< <std::char_traits<char> >':
/usr/include/c++/4.8/ostream:535: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
/usr/include/c++/4.8/ostream:535: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ios<char, std::char_traits<char> >::setstate(std::_Ios_Iostate)':
/usr/include/c++/4.8/bits/basic_ios.h:152: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
/usr/include/c++/4.8/bits/basic_ios.h:152: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ofstream<char, std::char_traits<char> >::close()':
/usr/include/c++/4.8/fstream:755: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::close()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `std::basic_ios<char, std::char_traits<char> >::setstate(std::_Ios_Iostate)':
/usr/include/c++/4.8/bits/basic_ios.h:152: undefined reference to `std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o): In function `__static_initialization_and_destruction_0':
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/include/c++/4.8/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
../../lib/x86_64-Linux//libcommon.a(FileOutput.o):(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
collect2: error: ld returned 1 exit status
make: *** [param] Error 1
Now I am in a dead-end. I have no experience or knowledge either as to what to do next. Could it be that libm is not functioning properly? The other answers in similar questions in this site didn't apply to my case.
EDIT:
Changing in Makefile.defined the "gcc" to "g++" results in the following output error: undefined reference to cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const*, int, float const*, int, float, float*, int) collect2: error: ld returned 1 exit status make: *** [param] Error 1
It seems unable to find the cblas library, even though I've linked both the include and lib directory.
This looks like a pretty broken makefile... You are compiling a C++ library (as it needs std::string) with a C compiler (gcc). It can't work. Try replacing gcc by g++ in Makefile.defines, and in any case report your bad experience to the developers of the library.

Boost Serialization compile error

I am using netbeans to develop a simple c++ program that uses boost serialization.
However when i try to compile the program i get a bunch of exceptions and errors:
CLEAN SUCCESSFUL (total time: 203ms)
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/bernd/NetBeansProjects/LVAManager'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/lvamanager
make[2]: Entering directory `/home/bernd/NetBeansProjects/LVAManager'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/LVA.o.d
g++ -c -g -I/usr/include/boost -MMD -MP -MF build/Debug/GNU-Linux-x86/LVA.o.d -o build/Debug/GNU-Linux-x86/LVA.o LVA.cpp
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/Manager.o.d
g++ -c -g -I/usr/include/boost -MMD -MP -MF build/Debug/GNU-Linux-x86/Manager.o.d -o build/Debug/GNU-Linux-x86/Manager.o Manager.cpp
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
g++ -c -g -I/usr/include/boost -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -o dist/Debug/GNU-Linux-x86/lvamanager build/Debug/GNU-Linux-x86/LVA.o build/Debug/GNU-Linux-x86/Manager.o build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `boost::archive::text_oarchive::text_oarchive(std::ostream&, unsigned int)':
/usr/include/boost/archive/text_oarchive.hpp:100: undefined reference to `boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::text_oarchive_impl(std::ostream&, unsigned int)'
build/Debug/GNU-Linux-x86/main.o: In function `boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::~text_oarchive_impl()':
/usr/include/boost/archive/text_oarchive.hpp:85: undefined reference to `boost::archive::basic_text_oprimitive<std::ostream>::~basic_text_oprimitive()'
/usr/include/boost/archive/text_oarchive.hpp:85: undefined reference to `boost::archive::basic_text_oprimitive<std::ostream>::~basic_text_oprimitive()'
build/Debug/GNU-Linux-x86/main.o: In function `boost::archive::detail::common_oarchive<boost::archive::text_oarchive>::~common_oarchive()':
/usr/include/boost/archive/detail/common_oarchive.hpp:35: undefined reference to `boost::archive::detail::basic_oarchive::~basic_oarchive()'
build/Debug/GNU-Linux-x86/main.o:(.rodata._ZTIN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEEE[_ZTIN5boost7archive6detail15common_oarchiveINS0_13text_oarchiveEEE]+0x18): undefined reference to `typeinfo for boost::archive::detail::basic_oarchive'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::version_type>(boost::archive::text_oarchive&, boost::archive::version_type const&)':
/usr/include/boost/archive/detail/oserializer.hpp:87: undefined reference to `boost::archive::detail::basic_oarchive::end_preamble()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::object_id_type>(boost::archive::text_oarchive&, boost::archive::object_id_type const&)':
/usr/include/boost/archive/detail/oserializer.hpp:87: undefined reference to `boost::archive::detail::basic_oarchive::end_preamble()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::object_reference_type>(boost::archive::text_oarchive&, boost::archive::object_reference_type const&)':
/usr/include/boost/archive/detail/oserializer.hpp:87: undefined reference to `boost::archive::detail::basic_oarchive::end_preamble()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_type>(boost::archive::text_oarchive&, boost::archive::class_id_type const&)':
/usr/include/boost/archive/detail/oserializer.hpp:87: undefined reference to `boost::archive::detail::basic_oarchive::end_preamble()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, boost::archive::class_id_reference_type>(boost::archive::text_oarchive&, boost::archive::class_id_reference_type const&)':
/usr/include/boost/archive/detail/oserializer.hpp:87: undefined reference to `boost::archive::detail::basic_oarchive::end_preamble()'
build/Debug/GNU-Linux-x86/main.o:/usr/include/boost/archive/detail/oserializer.hpp:87: more undefined references to `boost::archive::detail::basic_oarchive::end_preamble()' follow
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)':
/usr/include/boost/archive/text_oarchive.hpp:60: undefined reference to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)':
/usr/include/boost/archive/text_oarchive.hpp:60: undefined reference to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)':
/usr/include/boost/archive/text_oarchive.hpp:60: undefined reference to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)':
/usr/include/boost/archive/text_oarchive.hpp:60: undefined reference to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)':
/usr/include/boost/archive/text_oarchive.hpp:60: undefined reference to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()'
build/Debug/GNU-Linux-x86/main.o:/usr/include/boost/archive/text_oarchive.hpp:60: more undefined references to `boost::archive::basic_text_oarchive<boost::archive::text_oarchive>::newtoken()' follow
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::basic_text_oprimitive<std::ostream>::save<boost::archive::object_id_type>(boost::archive::object_id_type const&)':
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::basic_text_oprimitive<std::ostream>::save<boost::archive::object_reference_type>(boost::archive::object_reference_type const&)':
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::basic_text_oprimitive<std::ostream>::save<boost::archive::class_id_type>(boost::archive::class_id_type const&)':
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::basic_text_oprimitive<std::ostream>::save<boost::archive::class_id_reference_type>(boost::archive::class_id_reference_type const&)':
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::save_access::save_primitive<boost::archive::text_oarchive, std::string>(boost::archive::text_oarchive&, std::string const&)':
/usr/include/boost/archive/detail/oserializer.hpp:87: undefined reference to `boost::archive::detail::basic_oarchive::end_preamble()'
/usr/include/boost/archive/detail/oserializer.hpp:88: undefined reference to `boost::archive::text_oarchive_impl<boost::archive::text_oarchive>::save(std::string const&)'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::basic_text_oprimitive<std::ostream>::save<boost::archive::tracking_type>(boost::archive::tracking_type const&)':
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::archive::basic_text_oprimitive<std::ostream>::save<unsigned int>(unsigned int const&)':
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception::exception_code, char const*, char const*)'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
/usr/include/boost/archive/basic_text_oprimitive.hpp:91: undefined reference to `boost::archive::archive_exception::~archive_exception()'
build/Debug/GNU-Linux-x86/main.o: In function `boost::archive::archive_exception::archive_exception(boost::archive::archive_exception const&)':
/usr/include/boost/archive/archive_exception.hpp:43: undefined reference to `vtable for boost::archive::archive_exception'
/usr/include/boost/archive/archive_exception.hpp:43: undefined reference to `vtable for boost::archive::archive_exception'
build/Debug/GNU-Linux-x86/main.o: In function `void boost::serialization::throw_exception<boost::archive::archive_exception>(boost::archive::archive_exception const&)':
/usr/include/boost/serialization/throw_exception.hpp:36: undefined reference to `boost::archive::archive_exception::~archive_exception()'
/usr/include/boost/serialization/throw_exception.hpp:36: undefined reference to `typeinfo for boost::archive::archive_exception'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/lvamanager] Error 1
make[2]: Leaving directory `/home/bernd/NetBeansProjects/LVAManager'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/bernd/NetBeansProjects/LVAManager'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 4s)
I read that boost serialization is no header-only library.
Has this something to do with this? Netbeans knows the boost library and gives me code assistance etc... But do i need to link it anyway?
How can i link the library in Netbeans? where can i find it.
I have a debian system and libboost-all-dev installed.
You need to add -lboost_serialization to you linker command.
It is a long time since I used netbeans but as far as I can remember it was something like Build->Linker->Libraries.
You don't need to add -l I think netbeans does this for you.