Undefined Reference To (linking errors) - c++

Trying to compile a cpp program in I run into the following linking errors:
11:42:55 **** Incremental Build of configuration Debug for project mrconv ****
Info: Internal Builder is used for build
g++ "-IC:\\Users\\Jesse\\Documents\\Work\\Research\\FiberTracking\\Software\\mrtrix\\source\\mrtrix-0.2.11\\lib" "-IC:\\Users\\Jesse\\Programs\\gtk+\\lib" "-IC:\\Users\\Jesse\\Programs\\gtk+\\bin" "-IC:\\Users\\Jesse\\Programs\\gtk+\\include\\glib-2.0" "-IC:\\Users\\Jesse\\Programs\\gtk+\\lib\\glib-2.0\\include" "-IC:\\gtkmm64\\include\\glibmm-2.4\\glibmm" "-IC:\\gtkmm64\\include\\glibmm-2.4" "-IC:\\gtkmm64\\lib\\glibmm-2.4\\include" "-IC:\\gtkmm64\\include\\sigc++-2.0" "-IC:\\gtkmm64\\lib\\sigc++-2.0\\include" "-IC:\\Program Files (x86)\\GnuWin32\\include" "-IC:\\Program Files (x86)\\GnuWin32\\include\\gsl" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\mrconvert.o" "..\\src\\mrconvert.cpp"
g++ "-LC:\\GnuWin32\\lib\\" -o mrconv.exe "src\\mrconvert.o" -llibgsl
src\mrconvert.o: In function `main':
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:119: undefined reference to `MR::App::run(int, char**)'
src\mrconvert.o: In function `ZN5MyApp7executeEv':
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:123: undefined reference to `MR::parse_floats(std::string const&)'
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:167: undefined reference to `MR::DataType::parse(std::string const&)'
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:174: undefined reference to `MR::Image::parse_axes_specifier(MR::Image::Axes const&, std::string const&)'
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:201: undefined reference to `MR::parse_ints(std::string const&, int)'
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:225: undefined reference to `MR::ProgressBar::init(unsigned int, std::string const&)'
src\mrconvert.o: In function `_static_initialization_and_destruction_0':
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:55: undefined reference to `MR::Argument::End'
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:95: undefined reference to `MR::Option::End'
src\mrconvert.o: In function `ZNK2MR9Exception7displayEv':
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:187: undefined reference to `MR::Exception::level_offset'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:187: undefined reference to `MR::error'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:188: undefined reference to `MR::Exception::level_offset'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:188: undefined reference to `MR::info'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:189: undefined reference to `MR::debug'
src\mrconvert.o: In function `ZN2MR11ProgressBar3incEv':
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:451: undefined reference to `MR::ProgressBar::current_val'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:451: undefined reference to `MR::ProgressBar::current_val'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:452: undefined reference to `MR::ProgressBar::display'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:452: undefined reference to `MR::ProgressBar::stop'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:453: undefined reference to `MR::ProgressBar::multiplier'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:453: undefined reference to `MR::ProgressBar::stop_watch'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:453: undefined reference to `Glib::Timer::elapsed() const'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:453: undefined reference to `MR::ProgressBar::current_val'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:453: undefined reference to `MR::ProgressBar::multiplier'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:454: undefined reference to `MR::ProgressBar::percent'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:455: undefined reference to `MR::ProgressBar::percent'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:456: undefined reference to `MR::ProgressBar::display_func'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:458: undefined reference to `MR::ProgressBar::stop'
src\mrconvert.o: In function `ZN2MR11ProgressBar4doneEv':
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:461: undefined reference to `MR::ProgressBar::display'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/mrtrix.h:461: undefined reference to `MR::ProgressBar::done_func'
src\mrconvert.o: In function `ZN2MR5Image6ObjectD1Ev':
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/image/object.h:49: undefined reference to `MR::info'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/image/object.h:49: undefined reference to `MR::Image::Mapper::unmap(MR::Image::Header const&)'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/image/object.h:49: undefined reference to `MR::Image::Mapper::~Mapper()'
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/image/object.h:49: undefined reference to `MR::Image::Mapper::~Mapper()'
src\mrconvert.o: In function `ZN2MR5Image6Object3mapEv':
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/image/object.h:57: undefined reference to `MR::Image::Mapper::map(MR::Image::Header const&)'
src\mrconvert.o: In function `ZNK2MR7ArgBase9get_imageERNS_5Image6HeaderE':
C:/Users/Jesse/Documents/Work/Research/FiberTracking/Software/mrtrix/source/mrtrix-0.2.11/lib/args.h:201: undefined reference to `MR::Image::Object::create(std::string const&, MR::Image::Header&)'
src\mrconvert.o: In function `ZN5MyAppC1EiPPcPPKcPKN2MR8ArgumentEPKNS5_6OptionEPKjS3_S3_':
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:119: undefined reference to `MR::App::App(int, char**, char const**, MR::Argument const*, MR::Option const*, unsigned int const*, char const*, char const*)'
src\mrconvert.o: In function `ZN5MyAppD1Ev':
C:\Users\Jesse\workspace\mrconv\Debug/../src/mrconvert.cpp:119: undefined reference to `MR::App::~App()'
collect2.exe: error: ld returned 1 exit status
11:42:57 Build Finished (took 1s.854ms)
It would appear these are internal linking errors? How do I go about finding the source of these errors?

you need to compile all the files and link them together. It's either missing a cpp file or library

This might be the problem. You need to use -L to specify where library files are. -I is to specify where included files are located.
g++ "-IC:\\Users\\Jesse\\Documents\\Work\\Research\\FiberTracking\\Software\\mrtrix\\source\\mrtrix-0.2.11\\lib" "-IC:\\Users\\Jesse\\Programs\\gtk+\\lib" "-IC:\\Users\\Jesse\\Programs\\gtk+\\bin" "-IC:\\Users\\Jesse\\Programs\\gtk+\\include\\glib-2.0" "-IC:\\Users\\Jesse\\Programs\\gtk+\\lib\\glib-2.0\\include" "-IC:\\gtkmm64\\include\\glibmm-2.4\\glibmm" "-IC:\\gtkmm64\\include\\glibmm-2.4" "-IC:\\gtkmm64\\lib\\glibmm-2.4\\include" "-IC:\\gtkmm64\\include\\sigc++-2.0" "-IC:\\gtkmm64\\lib\\sigc++-2.0\\include" "-IC:\\Program Files (x86)\\GnuWin32\\include" "-IC:\\Program Files (x86)\\GnuWin32\\include\\gsl" -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\mrconvert.o" "..\\src\\mrconvert.cpp"
I think some of them shouldbe changed to -L. for example
"-IC:\\Users\\Jesse\...lib"
Should be
-L"C:\\Users\\Jesse\...lib"
And should go on the linkage line. i.e. The second line where you link everything.

Related

Linker errors when linking to Filament precompiled libraries

I am attempting to link to a number of libraries in a very rudimentary manner (without the use of any Makefile or CMakeLists.txt), using the following clang++ command:
FILAMENT_LIBS="-lassimp -lbackend -lbluegl -lbluevk -lcamutils -lfilabridge -lfilaflat -lfilagui -lfilamat -lfilamat_combined -lfilamat_lite -lfilament -lfilameshio -lgeometry -lgltfio -lgltfio_core -lgltfio_pipeline -lgltfio_resources -libl -limage -limageio -limgui -lmatdbg -lmatdbg_resources -lmath -lmeshoptimizer -lrays -lshaders -lsmol-v -lutils"
clang++-7 -L../lib/x86_64/ ${FILAMENT_LIBS} -lpthread -lc++ -ldl -lSDL2 -I./ -I../include/ -I../app/ -I${RESOURCE_DIR} -Wno-extern-c-compat -std=c++14 -pthread ../suzanne.cpp ../app/Cube.cpp ../app/FilamentApp.cpp ../app/IBL.cpp ../app/IcoSphere.cpp ../app/Image.cpp ../app/NativeWindowHelperLinux.cpp ../app/Sphere.cpp -o suzanne
However, this gives the error FilamentApp.cpp:(.text+0x4d2): undefined reference to... followed by what must be every single one of the calls to functions in the aforementioned libraries.
To give some context, I am attempting to compile one of the sample apps provided by the rendering engine Filament. When this is compiled with the source code, everything works no issues, but when I attempt to link against the precompiled versions of the libraries, I get the above error.
Additionally, when I attempt to link against the same libraries with the tester main.cpp file and accompanying Makefile as described in the Filament documentation, everything links and compiles completely fine.
I have a feeling I'm doing something obvious wrong here, specifically with the clang command I am using, but I can't for the life of me see what it is. Any help would be much appreciated!
Edit - first few lines of errors:
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::loop()':
Engine.cpp:(.text._ZN8filament7details7FEngine4loopEv+0x22): undefined reference to `filament::backend::DefaultPlatform::create(filament::backend::Backend*)'
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::init()':
Engine.cpp:(.text._ZN8filament7details7FEngine4initEv+0x1f): undefined reference to `filament::backend::CommandStream::CommandStream(filament::backend::Driver&, filament::backend::CircularBuffer&)'
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::FEngine(filament::backend::Backend, filament::backend::Platform*, void*)':
Engine.cpp:(.text._ZN8filament7details7FEngineC2ENS_7backend7BackendEPNS2_8PlatformEPv+0x267): undefined reference to `filament::backend::CommandBufferQueue::CommandBufferQueue(unsigned long, unsigned long)'
Engine.cpp:(.text._ZN8filament7details7FEngineC2ENS_7backend7BackendEPNS2_8PlatformEPv+0x332): undefined reference to `filaflat::ShaderBuilder::ShaderBuilder()'
Engine.cpp:(.text._ZN8filament7details7FEngineC2ENS_7backend7BackendEPNS2_8PlatformEPv+0x342): undefined reference to `filaflat::ShaderBuilder::ShaderBuilder()'
Engine.cpp:(.text._ZN8filament7details7FEngineC2ENS_7backend7BackendEPNS2_8PlatformEPv+0x462): undefined reference to `filaflat::ShaderBuilder::~ShaderBuilder()'
Engine.cpp:(.text._ZN8filament7details7FEngineC2ENS_7backend7BackendEPNS2_8PlatformEPv+0x471): undefined reference to `filaflat::ShaderBuilder::~ShaderBuilder()'
Engine.cpp:(.text._ZN8filament7details7FEngineC2ENS_7backend7BackendEPNS2_8PlatformEPv+0x4a2): undefined reference to `filament::backend::CommandBufferQueue::~CommandBufferQueue()'
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::~FEngine()':
Engine.cpp:(.text._ZN8filament7details7FEngineD2Ev+0x3e): undefined reference to `filament::backend::DefaultPlatform::destroy(filament::backend::DefaultPlatform**)'
Engine.cpp:(.text._ZN8filament7details7FEngineD2Ev+0x10c): undefined reference to `filaflat::ShaderBuilder::~ShaderBuilder()'
Engine.cpp:(.text._ZN8filament7details7FEngineD2Ev+0x118): undefined reference to `filaflat::ShaderBuilder::~ShaderBuilder()'
Engine.cpp:(.text._ZN8filament7details7FEngineD2Ev+0x148): undefined reference to `filament::backend::CommandBufferQueue::~CommandBufferQueue()'
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::shutdown()':
Engine.cpp:(.text._ZN8filament7details7FEngine8shutdownEv+0x207): undefined reference to `filament::backend::CommandBufferQueue::flush()'
Engine.cpp:(.text._ZN8filament7details7FEngine8shutdownEv+0x20f): undefined reference to `filament::backend::CommandBufferQueue::requestExit()'
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::flushCommandBuffer(filament::backend::CommandBufferQueue&)':
Engine.cpp:(.text._ZN8filament7details7FEngine18flushCommandBufferERNS_7backend18CommandBufferQueueE+0x12): undefined reference to `filament::backend::CommandBufferQueue::flush()'
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::flush()':
Engine.cpp:(.text._ZN8filament7details7FEngine5flushEv+0x19): undefined reference to `filament::backend::CommandBufferQueue::flush()'
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::execute()':
Engine.cpp:(.text._ZN8filament7details7FEngine7executeEv+0x1b): undefined reference to `filament::backend::CommandBufferQueue::waitForCommands() const'
Engine.cpp:(.text._ZN8filament7details7FEngine7executeEv+0x4c): undefined reference to `filament::backend::CommandStream::execute(void*)'
Engine.cpp:(.text._ZN8filament7details7FEngine7executeEv+0x57): undefined reference to `filament::backend::CommandBufferQueue::releaseBuffer(filament::backend::CommandBufferQueue::Slice const&)'
/tmp/suzanne-ef5171.o: In function `main::$_0::operator()(filament::Engine*, filament::View*, filament::Scene*) const':
suzanne.cpp:(.text+0x1dc0): undefined reference to `TEXTURES_ALBEDO_S3TC_OFFSET'
suzanne.cpp:(.text+0x1dc7): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1dce): undefined reference to `TEXTURES_ALBEDO_S3TC_SIZE'
suzanne.cpp:(.text+0x1e10): undefined reference to `TEXTURES_AO_OFFSET'
suzanne.cpp:(.text+0x1e17): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1e1d): undefined reference to `TEXTURES_AO_SIZE'
suzanne.cpp:(.text+0x1e5e): undefined reference to `TEXTURES_METALLIC_OFFSET'
suzanne.cpp:(.text+0x1e65): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1e6b): undefined reference to `TEXTURES_METALLIC_SIZE'
suzanne.cpp:(.text+0x1eac): undefined reference to `TEXTURES_ROUGHNESS_OFFSET'
suzanne.cpp:(.text+0x1eb3): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1eb9): undefined reference to `TEXTURES_ROUGHNESS_SIZE'
suzanne.cpp:(.text+0x1f85): undefined reference to `TEXTURES_NORMAL_OFFSET'
suzanne.cpp:(.text+0x1f8c): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1f93): undefined reference to `TEXTURES_NORMAL_SIZE'
suzanne.cpp:(.text+0x1fdb): undefined reference to `RESOURCES_TEXTUREDLIT_OFFSET'
suzanne.cpp:(.text+0x1fe2): undefined reference to `RESOURCES_PACKAGE'
suzanne.cpp:(.text+0x1fe9): undefined reference to `RESOURCES_TEXTUREDLIT_SIZE'
suzanne.cpp:(.text+0x21ea): undefined reference to `RESOURCES_SUZANNE_OFFSET'
suzanne.cpp:(.text+0x21f0): undefined reference to `RESOURCES_PACKAGE'
/tmp/FilamentApp-94694a.o: In function `FilamentApp::run(Config const&, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*)>, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*)>, std::__1::function<void (filament::Engine*, filament::View*)>, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*, filament::Renderer*)>, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*, filament::Renderer*)>, unsigned long, unsigned long)':
FilamentApp.cpp:(.text+0xd8e): undefined reference to `RESOURCES_DEPTHVISUALIZER_OFFSET'
FilamentApp.cpp:(.text+0xd95): undefined reference to `RESOURCES_PACKAGE'
FilamentApp.cpp:(.text+0xd9c): undefined reference to `RESOURCES_DEPTHVISUALIZER_SIZE'
FilamentApp.cpp:(.text+0xe2c): undefined reference to `RESOURCES_AIDEFAULTMAT_OFFSET'
FilamentApp.cpp:(.text+0xe33): undefined reference to `RESOURCES_PACKAGE'
FilamentApp.cpp:(.text+0xe3a): undefined reference to `RESOURCES_AIDEFAULTMAT_SIZE'
FilamentApp.cpp:(.text+0xeaf): undefined reference to `RESOURCES_TRANSPARENTCOLOR_OFFSET'
FilamentApp.cpp:(.text+0xeb6): undefined reference to `RESOURCES_PACKAGE'
FilamentApp.cpp:(.text+0xebd): undefined reference to `RESOURCES_TRANSPARENTCOLOR_SIZE'
/tmp/FilamentApp-94694a.o: In function `FilamentApp::Window::configureCamerasForWindow()':
FilamentApp.cpp:(.text+0x6902): undefined reference to `filament::Camera::setLensProjection(double, double, double, double)'
FilamentApp.cpp:(.text+0x6a34): undefined reference to `filament::Camera::lookAt(filament::math::details::TVec3<float> const&, filament::math::details::TVec3<float> const&)'
../lib/x86_64//libfilament.a(VertexBuffer.cpp.o): In function `filament::VertexBuffer::Builder::attribute(filament::VertexAttribute, unsigned char, filament::backend::ElementType, unsigned int, unsigned char)':
Edit 2 - error list after 2nd alteration:
/tmp/suzanne-e10eca.o: In function `main::$_0::operator()(filament::Engine*, filament::View*, filament::Scene*) const':
suzanne.cpp:(.text+0x1dc0): undefined reference to `TEXTURES_ALBEDO_S3TC_OFFSET'
suzanne.cpp:(.text+0x1dc7): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1dce): undefined reference to `TEXTURES_ALBEDO_S3TC_SIZE'
suzanne.cpp:(.text+0x1e10): undefined reference to `TEXTURES_AO_OFFSET'
suzanne.cpp:(.text+0x1e17): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1e1d): undefined reference to `TEXTURES_AO_SIZE'
suzanne.cpp:(.text+0x1e5e): undefined reference to `TEXTURES_METALLIC_OFFSET'
suzanne.cpp:(.text+0x1e65): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1e6b): undefined reference to `TEXTURES_METALLIC_SIZE'
suzanne.cpp:(.text+0x1eac): undefined reference to `TEXTURES_ROUGHNESS_OFFSET'
suzanne.cpp:(.text+0x1eb3): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1eb9): undefined reference to `TEXTURES_ROUGHNESS_SIZE'
suzanne.cpp:(.text+0x1f85): undefined reference to `TEXTURES_NORMAL_OFFSET'
suzanne.cpp:(.text+0x1f8c): undefined reference to `TEXTURES_PACKAGE'
suzanne.cpp:(.text+0x1f93): undefined reference to `TEXTURES_NORMAL_SIZE'
suzanne.cpp:(.text+0x1fdb): undefined reference to `RESOURCES_TEXTUREDLIT_OFFSET'
suzanne.cpp:(.text+0x1fe2): undefined reference to `RESOURCES_PACKAGE'
suzanne.cpp:(.text+0x1fe9): undefined reference to `RESOURCES_TEXTUREDLIT_SIZE'
suzanne.cpp:(.text+0x21ea): undefined reference to `RESOURCES_SUZANNE_OFFSET'
suzanne.cpp:(.text+0x21f0): undefined reference to `RESOURCES_PACKAGE'
/tmp/FilamentApp-0b5ad4.o: In function `FilamentApp::run(Config const&, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*)>, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*)>, std::__1::function<void (filament::Engine*, filament::View*)>, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*, filament::Renderer*)>, std::__1::function<void (filament::Engine*, filament::View*, filament::Scene*, filament::Renderer*)>, unsigned long, unsigned long)':
FilamentApp.cpp:(.text+0xd8e): undefined reference to `RESOURCES_DEPTHVISUALIZER_OFFSET'
FilamentApp.cpp:(.text+0xd95): undefined reference to `RESOURCES_PACKAGE'
FilamentApp.cpp:(.text+0xd9c): undefined reference to `RESOURCES_DEPTHVISUALIZER_SIZE'
FilamentApp.cpp:(.text+0xe2c): undefined reference to `RESOURCES_AIDEFAULTMAT_OFFSET'
FilamentApp.cpp:(.text+0xe33): undefined reference to `RESOURCES_PACKAGE'
FilamentApp.cpp:(.text+0xe3a): undefined reference to `RESOURCES_AIDEFAULTMAT_SIZE'
FilamentApp.cpp:(.text+0xeaf): undefined reference to `RESOURCES_TRANSPARENTCOLOR_OFFSET'
FilamentApp.cpp:(.text+0xeb6): undefined reference to `RESOURCES_PACKAGE'
FilamentApp.cpp:(.text+0xebd): undefined reference to `RESOURCES_TRANSPARENTCOLOR_SIZE'
/tmp/FilamentApp-0b5ad4.o: In function `FilamentApp::Window::configureCamerasForWindow()':
FilamentApp.cpp:(.text+0x6902): undefined reference to `filament::Camera::setLensProjection(double, double, double, double)'
FilamentApp.cpp:(.text+0x6a34): undefined reference to `filament::Camera::lookAt(filament::math::details::TVec3<float> const&, filament::math::details::TVec3<float> const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Edit 3
The variables referred to in the above errors are stored in the files
./generated/resources/resources.h and
./generated/resources/textures.h,
in relation to the clang++ directory of execution. The header file includes for these files look like this:
#include "generated/resources/resources.h"
#include "generated/resources/textures.h"
and I have included -I./ in the clang command, so surely clang should be able to see these files?
Here is textures.h:
#ifndef TEXTURES_H_
#define TEXTURES_H_
#include <stdint.h>
extern "C" {
extern const uint8_t TEXTURES_PACKAGE[];
extern int TEXTURES_ALBEDO_S3TC_OFFSET;
extern int TEXTURES_ALBEDO_S3TC_SIZE;
extern int TEXTURES_ROUGHNESS_OFFSET;
extern int TEXTURES_ROUGHNESS_SIZE;
extern int TEXTURES_METALLIC_OFFSET;
extern int TEXTURES_METALLIC_SIZE;
extern int TEXTURES_AO_OFFSET;
extern int TEXTURES_AO_SIZE;
extern int TEXTURES_NORMAL_OFFSET;
extern int TEXTURES_NORMAL_SIZE;
}
#define TEXTURES_ALBEDO_S3TC_DATA (TEXTURES_PACKAGE + TEXTURES_ALBEDO_S3TC_OFFSET)
#define TEXTURES_ROUGHNESS_DATA (TEXTURES_PACKAGE + TEXTURES_ROUGHNESS_OFFSET)
#define TEXTURES_METALLIC_DATA (TEXTURES_PACKAGE + TEXTURES_METALLIC_OFFSET)
#define TEXTURES_AO_DATA (TEXTURES_PACKAGE + TEXTURES_AO_OFFSET)
#define TEXTURES_NORMAL_DATA (TEXTURES_PACKAGE + TEXTURES_NORMAL_OFFSET)
#endif
Edit 4:
Error list after finding resource libraries:
/tmp/FilamentApp-11fd11.o: In function `FilamentApp::Window::configureCamerasForWindow()':
FilamentApp.cpp:(.text+0x6902): undefined reference to `filament::Camera::setLensProjection(double, double, double, double)'
FilamentApp.cpp:(.text+0x6a34): undefined reference to `filament::Camera::lookAt(filament::math::details::TVec3<float> const&, filament::math::details::TVec3<float> const&)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Edit 5:
Some more errors...
../lib/x86_64//libfilament.a(Engine.cpp.o): In function `filament::details::FEngine::loop()':
/home/joel/Documents/KiwiTest/filament-source/out/cmake-debug/../../filament/src/Engine.cpp:448: undefined reference to `filament::matdbg::DebugServer::DebugServer(filament::backend::Backend, int)'
/home/joel/Documents/KiwiTest/filament-source/out/cmake-debug/../../filament/src/Engine.cpp:453: undefined reference to `filament::matdbg::DebugServer::~DebugServer()'
../lib/x86_64//libfilament.a(Material.cpp.o): In function `filament::Material::Builder::build(filament::Engine&)':
/home/joel/Documents/KiwiTest/filament-source/out/cmake-debug/../../filament/src/Material.cpp:110: undefined reference to `filament::matdbg::DebugServer::addMaterial(utils::CString const&, void const*, unsigned long, void*)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Put all libraries last on the line when compiling:
clang++-7 -stdlib=libc++ -L../lib/x86_64/ -I./ -I../include/ -I../app/ -I${RESOURCE_DIR} -Wno-extern-c-compat -std=c++14 ../suzanne.cpp ../app/Cube.cpp ../app/FilamentApp.cpp ../app/IBL.cpp ../app/IcoSphere.cpp ../app/Image.cpp ../app/NativeWindowHelperLinux.cpp ../app/Sphere.cpp -o suzanne ${FILAMENT_LIBS} -lSDL2 -ldl -pthread
Also, use only -pthread (remove -lpthread). There's no need for both.
You may also want to remove -lc++ and replace it with -stdlib=libc++ (which does not need to be towards the end of the line).
What happens when linking your program is that when the linker encounters a symbol (function) that has not been encountered before, it puts it on a list of unresolved symbols. For every library it examines after that, the unresolved symbols are checked. If it encounters symbols that exists in libraries already examined, linking will fail.
The ordering of the filament libraries is also important so try:
FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v -libl
as stated in the documentation. Note that I removed the non-filament libraries from FILAMENT_LIBS. Put those libraries in a separate variable and place that before the FILAMENT_LIBS variable when compiling.
If SDL2 uses filament, you should put -lSDL2 before the filament libraries, otherwise, leave it where it is.
If it's still failing, you can, as a last resort, wrap the filament libraries in a library group to make it resolve the internal filament dependencies:
-Wl,--start-group $(FILAMENT_LIBS) -Wl,--end-group
This is however not what you want since it's slow, but, it's an option.
An even more desperate option would be to wrap all libraries inside the -Wl,--start-group ... -Wl,--end-group pair just to verify that it compiles and that you have all the libraries and object files needed.

hadoop pipes undefined reference while linking C++ wordcount in ubuntu 16.04 and g++ 5.4.0

I am trying to run the c++ word count program in hadoop. When I run the following command:
g++ wordcount.cpp -o a -L/usr/local/hadoop/lib/native -lhadooppipes -lhadooputils -lpthread -I/usr/local/hadoop/include -Wall
I am getting the following errors:
/tmp/ccfwwM9D.o: In function `WordCountMap::map(HadoopPipes::MapContext&)':
wordcount.cpp:(.text._ZN12WordCountMap3mapERN11HadoopPipes10MapContextE[_ZN12WordCountMap3mapERN11HadoopPipes10MapContextE]+0x4a): undefined reference to `HadoopUtils::splitString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)'
/tmp/ccfwwM9D.o: In function `WordCountReduce::reduce(HadoopPipes::ReduceContext&)':
wordcount.cpp:(.text._ZN15WordCountReduce6reduceERN11HadoopPipes13ReduceContextE[_ZN15WordCountReduce6reduceERN11HadoopPipes13ReduceContextE]+0x5d): undefined reference to `HadoopUtils::toInt(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
wordcount.cpp:(.text._ZN15WordCountReduce6reduceERN11HadoopPipes13ReduceContextE[_ZN15WordCountReduce6reduceERN11HadoopPipes13ReduceContextE]+0x81): undefined reference to `HadoopUtils::toString[abi:cxx11](int)'
/usr/local/hadoop/lib/native/libhadooppipes.a(HadoopPipes.cc.o): In function `HadoopPipes::BinaryProtocol::createDigest(std::string&, std::string&)':
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:426: undefined reference to `EVP_sha1'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:426: undefined reference to `HMAC_Init'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:427: undefined reference to `HMAC_Update'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:429: undefined reference to `HMAC_Final'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:430: undefined reference to `HMAC_CTX_cleanup'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:436: undefined reference to `BIO_f_base64'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:436: undefined reference to `BIO_new'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:437: undefined reference to `BIO_s_mem'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:437: undefined reference to `BIO_new'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:438: undefined reference to `BIO_push'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:439: undefined reference to `BIO_write'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:440: undefined reference to `BIO_ctrl'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:441: undefined reference to `BIO_ctrl'
/home/ambari-qa/hadoop/hadoop-tools/hadoop-pipes/src/main/native/pipes/impl/HadoopPipes.cc:446: undefined reference to `BIO_free_all'
collect2: error: ld returned 1 exit status

How to fix undefined reference to v8 error?

I'm trying to configure and build a sample of node.js addon. The sample was taken from node.js documentation and the source code can be found here
https://github.com/nodejs/node-addon-examples/tree/master/8_passing_wrapped/node_0.12
When I try to compile this in CLion (on Ubuntu 14.04) or when I use node-gyp to build it I've got some errors:
/home/smorzhov/Documents/clion-2016.1/bin/cmake/bin/cmake --build /home/smorzhov/.CLion2016.1/system/cmake/generated/test4-94ee4803/94ee4803/Debug --target all -- -j 4
[ 25%] Linking CXX executable test4
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::Init(v8::Isolate*)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:26: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:27: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::String::NewStringType, int)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:27: undefined reference to `v8::FunctionTemplate::SetClassName(v8::Local<v8::String>)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:28: undefined reference to `v8::FunctionTemplate::InstanceTemplate()'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:28: undefined reference to `v8::ObjectTemplate::SetInternalFieldCount(int)'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:30: undefined reference to `v8::FunctionTemplate::GetFunction()'
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:30: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Function>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Function>::New(v8::Isolate*, v8::Function*)':
/usr/include/node/v8.h:7176: undefined reference to `v8::V8::GlobalizeReference(v8::internal::Isolate*, v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `Reset<v8::Function>':
/usr/include/node/v8.h:7235: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::New(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:38: undefined reference to `v8::Value::NumberValue() const'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::PersistentBase<v8::Function> const&)':
/usr/include/node/v8.h:7124: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::Function*)':
/usr/include/node/v8.h:7134: undefined reference to `v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::New(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:47: undefined reference to `v8::Function::NewInstance(int, v8::Local<v8::Value>*) const'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::PersistentBase<v8::Function> const&)':
/usr/include/node/v8.h:7124: undefined reference to `demo::MyObject::constructor'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Function>::New(v8::Isolate*, v8::Function*)':
/usr/include/node/v8.h:7134: undefined reference to `v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `demo::MyObject::NewInstance(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/myobject.cpp:57: undefined reference to `v8::Function::NewInstance(int, v8::Local<v8::Value>*) const'
CMakeFiles/test4.dir/myobject.cpp.o: In function `ClearWeak<void>':
/usr/include/node/v8.h:7298: undefined reference to `v8::V8::ClearWeak(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `node::ObjectWrap::Wrap(v8::Local<v8::Object>)':
/usr/include/node/node_object_wrap.h:56: undefined reference to `v8::Object::InternalFieldCount()'
/usr/include/node/node_object_wrap.h:57: undefined reference to `v8::Object::SetAlignedPointerInInternalField(int, void*)'
/usr/include/node/node_object_wrap.h:58: undefined reference to `v8::Isolate::GetCurrent()'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::New(v8::Isolate*, v8::Object*)':
/usr/include/node/v8.h:7176: undefined reference to `v8::V8::GlobalizeReference(v8::internal::Isolate*, v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `SetWeak<v8::Object, node::ObjectWrap>':
/usr/include/node/v8.h:7257: undefined reference to `v8::V8::MakeWeak(v8::internal::Object**, void*, void (*)(v8::WeakCallbackData<v8::Value, void> const&))'
CMakeFiles/test4.dir/myobject.cpp.o: In function `ClearWeak<void>':
/usr/include/node/v8.h:7298: undefined reference to `v8::V8::ClearWeak(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `node::ObjectWrap::WeakCallback(v8::WeakCallbackData<v8::Object, node::ObjectWrap> const&)':
/usr/include/node/node_object_wrap.h:101: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::Local<v8::Object>::New(v8::Isolate*, v8::Object*)':
/usr/include/node/v8.h:7134: undefined reference to `v8::HandleScope::CreateHandle(v8::internal::Isolate*, v8::internal::Object*)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `v8::PersistentBase<v8::Object>::Reset()':
/usr/include/node/v8.h:7224: undefined reference to `v8::V8::DisposeGlobal(v8::internal::Object**)'
CMakeFiles/test4.dir/myobject.cpp.o: In function `node::ObjectWrap::WeakCallback(v8::WeakCallbackData<v8::Object, node::ObjectWrap> const&)':
/usr/include/node/node_object_wrap.h:108: undefined reference to `v8::HandleScope::~HandleScope()'
/usr/include/node/node_object_wrap.h:108: undefined reference to `v8::HandleScope::~HandleScope()'
CMakeFiles/test4.dir/addon.cpp.o: In function `demo::Add(v8::FunctionCallbackInfo<v8::Value> const&)':
/home/smorzhov/ClionProjects/test4/test4/addon.cpp:27: undefined reference to `v8::Number::New(v8::Isolate*, double)'
CMakeFiles/test4.dir/addon.cpp.o: In function `demo::InitAll(v8::Local<v8::Object>)':
/home/smorzhov/ClionProjects/test4/test4/addon.cpp:31: undefined reference to `v8::Object::GetIsolate()'
CMakeFiles/test4.dir/addon.cpp.o: In function `_register_addon':
/home/smorzhov/ClionProjects/test4/test4/addon.cpp:37: undefined reference to `node_module_register'
CMakeFiles/test4.dir/addon.cpp.o: In function `v8::Value::ToObject() const':
/usr/include/node/v8.h:7778: undefined reference to `v8::Isolate::GetCurrent()'
/usr/include/node/v8.h:7778: undefined reference to `v8::Isolate::GetCurrentContext()'
/usr/include/node/v8.h:7779: undefined reference to `v8::Value::ToObject(v8::Local<v8::Context>) const'
CMakeFiles/test4.dir/addon.cpp.o: In function `demo::MyObject* node::ObjectWrap::Unwrap<demo::MyObject>(v8::Local<v8::Object>)':
/usr/include/node/node_object_wrap.h:29: undefined reference to `v8::Object::InternalFieldCount()'
CMakeFiles/test4.dir/addon.cpp.o: In function `v8::Object::GetAlignedPointerFromInternalField(int)':
/usr/include/node/v8.h:7636: undefined reference to `v8::Object::SlowGetAlignedPointerFromInternalField(int)'
CMakeFiles/test4.dir/addon.cpp.o: In function `void node::NODE_SET_METHOD<v8::Local<v8::Object> >(v8::Local<v8::Object> const&, char const*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&))':
/usr/include/node/node.h:239: undefined reference to `v8::Isolate::GetCurrent()'
/usr/include/node/node.h:240: undefined reference to `v8::HandleScope::HandleScope(v8::Isolate*)'
/usr/include/node/node.h:242: undefined reference to `v8::FunctionTemplate::New(v8::Isolate*, void (*)(v8::FunctionCallbackInfo<v8::Value> const&), v8::Local<v8::Value>, v8::Local<v8::Signature>, int)'
/usr/include/node/node.h:243: undefined reference to `v8::FunctionTemplate::GetFunction()'
/usr/include/node/node.h:244: undefined reference to `v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::String::NewStringType, int)'
/usr/include/node/node.h:245: undefined reference to `v8::Function::SetName(v8::Local<v8::String>)'
/usr/include/node/node.h:246: undefined reference to `v8::Object::Set(v8::Local<v8::Value>, v8::Local<v8::Value>)'
/usr/include/node/node.h:246: undefined reference to `v8::HandleScope::~HandleScope()'
/usr/include/node/node.h:246: undefined reference to `v8::HandleScope::~HandleScope()'
collect2: error: ld returned 1 exit status
make[2]: *** [test4] Error 1
make[1]: *** [CMakeFiles/test4.dir/all] Error 2
make: *** [all] Error 2
Maybe it is important, the IDE don't understand
#include node.h
and I have to change it to #include node/node.h
It seems, that compiler sees only node and v8 headers and cannot find their sources.
Can somebody help me to fix that? How to make compiler to see node and v8 sources?
PS. My CmakeLists.txt file
cmake_minimum_required(VERSION 3.3)
project(test4)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES addon.cpp main.cpp myobject.cpp myobject.h)
add_executable(test4 ${SOURCE_FILES})
If you follow the README and use node-gyp with the -v flag, you can see that compilation looks like this:
g++ '-DNODE_GYP_MODULE_NAME=addon' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/yannick/.node-gyp/5.9.0/include/node -I/home/yannick/.node-gyp/5.9.0/src -I/home/yannick/.node-gyp/5.9.0/deps/uv/include -I/home/yannick/.node-gyp/5.9.0/deps/v8/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF ./Release/.deps/Release/obj.target/addon/myobject.o.d.raw -c -o Release/obj.target/addon/myobject.o ../myobject.cc
So it's a tad more complex that just specifying a few sources : there are several include dirs to be used, that seems specific to the node version you are running, and include an external dependency (libuv)
Why don't you use the build methods suggested by the README ?

TBB link with C++

I am trying to do some tests with TBB at HPCG benchmark. However I didn't compiled the program successfully so far. I am getting errors like these:
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::~start_for()':
ComputeSPMV_ref.cpp:(.text+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::~start_for()':
ComputeSPMV_ref.cpp:(.text+0x23): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::start_for<tbb::blocked_range<int>, tbb::internal::parallel_for_body<ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)::{lambda(int)#1}, int>, tbb::auto_partitioner const>::execute()':
ComputeSPMV_ref.cpp:(.text+0x182): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x1ad): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x26b): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x296): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x43b): undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x470): undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0x52c): undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
src/ComputeSPMV_ref.o: In function `ComputeSPMV_ref(SparseMatrix_STRUCT const&, Vector_STRUCT&, Vector_STRUCT&)':
ComputeSPMV_ref.cpp:(.text+0x9d0): undefined reference to `tbb::task_group_context::init()'
ComputeSPMV_ref.cpp:(.text+0x9e9): undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned long) const'
ComputeSPMV_ref.cpp:(.text+0xa29): undefined reference to `tbb::internal::get_initial_auto_partitioner_divisor()'
ComputeSPMV_ref.cpp:(.text+0xa52): undefined reference to `tbb::task_group_context::~task_group_context()'
ComputeSPMV_ref.cpp:(.text+0xad4): undefined reference to `tbb::task_group_context::~task_group_context()'
ComputeSPMV_ref.cpp:(.text+0xae0): undefined reference to `vtable for tbb::task'
ComputeSPMV_ref.cpp:(.text+0xaee): undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::flag_task::~flag_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal9flag_taskD2Ev[_ZN3tbb10interface68internal9flag_taskD5Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::signal_task::~signal_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal11signal_taskD2Ev[_ZN3tbb10interface68internal11signal_taskD5Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::flag_task::~flag_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal9flag_taskD0Ev[_ZN3tbb10interface68internal9flag_taskD0Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o: In function `tbb::interface6::internal::signal_task::~signal_task()':
ComputeSPMV_ref.cpp:(.text._ZN3tbb10interface68internal11signal_taskD0Ev[_ZN3tbb10interface68internal11signal_taskD0Ev]+0x3): undefined reference to `vtable for tbb::task'
src/ComputeSPMV_ref.o:(.rodata+0x110): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTIN3tbb10interface68internal11signal_taskE[_ZTIN3tbb10interface68internal11signal_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTIN3tbb10interface68internal9flag_taskE[_ZTIN3tbb10interface68internal9flag_taskE]+0x10): undefined reference to `typeinfo for tbb::task'
src/ComputeSPMV_ref.o:(.rodata._ZTVN3tbb10interface68internal9flag_taskE[_ZTVN3tbb10interface68internal9flag_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
src/ComputeSPMV_ref.o:(.rodata._ZTVN3tbb10interface68internal11signal_taskE[_ZTVN3tbb10interface68internal11signal_taskE]+0x28): undefined reference to `tbb::task::note_affinity(unsigned short)'
collect2: error: ld returned 1 exit status
make: *** [bin/xhpcg] Error 1
Compile instruction look like this:
make
/usr/bin/g++ -DHPCG_NOMPI -DHPCG_NOOPENMP -I./src -I./src/GCC_TBB -O3 -ltbb -std=c++11 -ffast-math -ftree-vectorize -ftree-vectorizer-verbose=0 -fopenmp testing/main.o src/CG.o src/CG_ref.o ....
I downloaded and install latest source code from Intel.Also I already use -ltbb and -std=c++11 at compile time and I include tbb files inside my code. I can't figure out the problem so far. Does anyone face anything like this before with Intel TBB? I am assuming that is something with the linking of library but I can't figure it out
Try to insert "-ltbb -std=c++11" just before -o and it should work!
Patroklos Patroklou's answer didn't help, so I put -ltbb at the end of my command and it worked.
Ubuntu 20.04
g++-9, libstdc++-9-dev

compile c++ file includes are not being found [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 8 years ago.
i am geting some errors into compiling a program, for some reason it won't get my included library.
am i using the compiler correctly? im listing my directories below and the output of the compiler.
Thanks,
im including like this : #include "lib/RF24/RF24.h"
pi#raspberrypigym ~/sandbox $ ls
examples lib Makefile readme.md test.cpp
pi#raspberrypigym ~/sandbox/lib $ ls
RF24
pi#raspberrypigym ~/sandbox/lib/RF24 $ ls
bcm2835.c bcm2835.o nRF24L01.h RF24.cpp RF24.o
bcm2835.h librf24-bcm.so.1.0 RF24_config.h RF24.h
pi#raspberrypigym ~/sandbox $ g++ -Wall test.cpp -o test
/tmp/ccXhlYKu.o: In function `setup()':
test.cpp:(.text+0x14): undefined reference to `RF24::begin()'
test.cpp:(.text+0x24): undefined reference to `RF24::setRetries(unsigned char, unsigned char)'
test.cpp:(.text+0x3c): undefined reference to `RF24::setChannel(unsigned char)'
test.cpp:(.text+0x48): undefined reference to `RF24::setPALevel(unsigned char)'
test.cpp:(.text+0x54): undefined reference to `RF24::setPALevel(unsigned char)'
test.cpp:(.text+0x60): undefined reference to `RF24::setDataRate(rf24_datarate_e)'
test.cpp:(.text+0x70): undefined reference to `RF24::openWritingPipe(unsigned long long)'
test.cpp:(.text+0x84): undefined reference to `RF24::openReadingPipe(unsigned char, unsigned long long)'
test.cpp:(.text+0x8c): undefined reference to `RF24::startListening()'
test.cpp:(.text+0x94): undefined reference to `RF24::printDetails()'
/tmp/ccXhlYKu.o: In function `main':
test.cpp:(.text+0x138): undefined reference to `RF24::stopListening()'
test.cpp:(.text+0x154): undefined reference to `RF24::write(void const*, unsigned char)'
test.cpp:(.text+0x15c): undefined reference to `RF24::startListening()'
test.cpp:(.text+0x164): undefined reference to `RF24::available()'
test.cpp:(.text+0x180): undefined reference to `RF24::read(void*, unsigned char)'
/tmp/ccXhlYKu.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x22c): undefined reference to `RF24::RF24(unsigned char, unsigned char, unsigned int)'
collect2: ld returned 1 exit status
g++ -Wall test.cpp -o test
You do not link your library.