Unable to compile sfml with imgui using makefile - sfml

I was trying to compile a project into executable which uses sfml and imgui
I used imgui-sfml a third-party library which makes it possible
I also followed the tutorial ImGui+SFML Tutorial and setup the folder structure according to that but instead of using visual studio I wrote my own Makefile for compiling it
Github Repository from YouTube Tutorial
I cloned it and just moved the dlls in source directory to bin because once the program is compiled it needs those to run
Folder Structure:https://i.stack.imgur.com/BJ1o9.png
Makefile
libs=-lsfml-window -lsfml-graphics -lsfml-system -lopengl32
lib_path=-L./libraries/lib
includes=-I./libraries/include -I./imgui/include
o_files=main.o imgui.o imgui-SFML.o imgui_tables.o imgui_draw.o imgui_widgets.o
cmds=-g -Wall -std=c++17
all:main.o imgui.o
g++ $(o_files) $(cmds) -o main $(includes) $(lib_path) $(libs) #❌ gives error
main.o:main.cpp
g++ main.cpp $(cmds) -c $(includes) #✅ success compiling
imgui.o:
g++ ./imgui/src/* $(cmds) -c $(includes) #✅ success compiling
clean:
rm -r *.o
Running the Makefile in Terminal
https://i.stack.imgur.com/l2wcW.png
Errors
g++ main.cpp -g -Wall -std=c++17 -c -I./libraries/include -I./imgui/include
g++ ./imgui/src/* -g -Wall -std=c++17 -c -I./libraries/include -I./imgui/include
g++ main.o imgui.o imgui-SFML.o imgui_tables.o imgui_draw.o imgui_widgets.o -g -Wall -std=c++17 -o ./bin/main.exe -I./libraries/include -I./imgui/include -L./libraries/lib -lsfml-window -lsfml-graphics -lsfml-system -lopengl32
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: main.o: in function `main':
D:\Projects\c++\sfml_imgui/main.cpp:8: undefined reference to `__imp__ZN2sf6StringC1EPKcRKSt6locale'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:8: undefined reference to `__imp__ZN2sf9VideoModeC1Ejjj'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:8: undefined reference to `__imp__ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:16: undefined reference to `__imp__ZN2sf11CircleShapeC1Efy'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:17: undefined reference to `__imp__ZN2sf5ColorC1Ehhhh'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:17: undefined reference to `__imp__ZN2sf5Shape12setFillColorERKNS_5ColorE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:23: undefined reference to `__imp__ZN2sf13Transformable9setOriginEff'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:24: undefined reference to `__imp__ZN2sf13Transformable11setPositionEff'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:26: undefined reference to `__imp__ZN2sf5ClockC1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:27: undefined reference to `__imp__ZNK2sf6Window6isOpenEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:30: undefined reference to `__imp__ZN2sf6Window9pollEventERNS_5EventE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:34: undefined reference to `__imp__ZN2sf6Window5closeEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:36: undefined reference to `__imp__ZN2sf5Clock7restartEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:47: undefined reference to `__imp__ZN2sf11CircleShape9setRadiusEf'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:48: undefined reference to `__imp__ZN2sf13Transformable9setOriginEff'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:49: undefined reference to `__imp__ZN2sf11CircleShape13setPointCountEy'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:50: undefined reference to `__imp__ZN2sf5ColorC1Ehhhh'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:50: undefined reference to `__imp__ZN2sf5Shape12setFillColorERKNS_5ColorE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:57: undefined reference to `__imp__ZN2sf5ColorC1Ehhhh'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:57: undefined reference to `__imp__ZN2sf12RenderTarget5clearERKNS_5ColorE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:59: undefined reference to `__imp__ZN2sf12RenderStates7DefaultE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:59: undefined reference to `__imp__ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:61: undefined reference to `__imp__ZN2sf6Window7displayEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:8: undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/main.cpp:8: undefined reference to `__imp__ZN2sf12RenderWindowD1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: main.o: in function `sf::CircleShape::~CircleShape()':
D:\Projects\c++\sfml_imgui/./libraries/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZTVN2sf11CircleShapeE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./libraries/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZTVN2sf11CircleShapeE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./libraries/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `__imp__ZN2sf5ShapeD2Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::SFML::Init(sf::Window&, sf::Vector2<float> const&, bool)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:260: undefined reference to `__imp__ZN2sf7TextureD1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:262: undefined reference to `__imp__ZN2sf7TextureC1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:270: undefined reference to `__imp__ZNK2sf6Window8hasFocusEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::SFML::Update(sf::Window&, sf::RenderTarget&, sf::Time)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:370: undefined reference to `__imp__ZN2sf5Touch6isDownEj'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:370: undefined reference to `__imp__ZN2sf5Touch11getPositionEjRKNS_6WindowE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:374: undefined reference to `__imp__ZN2sf5Mouse11getPositionERKNS_6WindowE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:379: undefined reference to `__imp__ZN2sf6Window21setMouseCursorVisibleEb'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::SFML::Update(sf::Vector2<int> const&, sf::Vector2<float> const&, sf::Time)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:387: undefined reference to `__imp__ZNK2sf4Time9asSecondsEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:393: undefined reference to `__imp__ZN2sf5Mouse11setPositionERKNS_7Vector2IiEE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:398: undefined reference to `__imp__ZN2sf5Touch6isDownEj'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:399: undefined reference to `__imp__ZN2sf5Mouse15isButtonPressedENS0_6ButtonE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::SFML::Render(sf::RenderTarget&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:443: undefined reference to `__imp__ZN2sf12RenderTarget13resetGLStatesEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:444: undefined reference to `__imp__ZN2sf12RenderTarget12pushGLStatesEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:447: undefined reference to `__imp__ZN2sf12RenderTarget11popGLStatesEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::SFML::Shutdown()':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:459: undefined reference to `__imp__ZN2sf7TextureD1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:465: undefined reference to `__imp__ZN2sf6CursorD1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::SFML::UpdateFontTexture()':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:483: undefined reference to `__imp__ZN2sf7Texture6createEjj'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:484: undefined reference to `__imp__ZN2sf7Texture6updateEPKh'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:486: undefined reference to `__imp__ZNK2sf7Texture15getNativeHandleEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::Image(sf::Texture const&, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:540: undefined reference to `__imp__ZNK2sf7Texture7getSizeEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::Image(sf::Texture const&, sf::Vector2<float> const&, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:545: undefined reference to `__imp__ZNK2sf7Texture15getNativeHandleEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::Image(sf::RenderTexture const&, sf::Vector2<float> const&, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:560: undefined reference to `__imp__ZNK2sf13RenderTexture10getTextureEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:560: undefined reference to `__imp__ZNK2sf7Texture15getNativeHandleEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::Image(sf::Sprite const&, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:571: undefined reference to `__imp__ZNK2sf6Sprite15getGlobalBoundsEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::Image(sf::Sprite const&, sf::Vector2<float> const&, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:577: undefined reference to `__imp__ZNK2sf6Sprite10getTextureEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:584: undefined reference to `__imp__ZNK2sf7Texture7getSizeEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:585: undefined reference to `__imp__ZNK2sf6Sprite14getTextureRectEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:590: undefined reference to `__imp__ZNK2sf7Texture15getNativeHandleEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::ImageButton(sf::Texture const&, int, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:600: undefined reference to `__imp__ZNK2sf7Texture7getSizeEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::ImageButton(sf::Texture const&, sf::Vector2<float> const&, int, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:606: undefined reference to `__imp__ZNK2sf7Texture15getNativeHandleEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::ImageButton(sf::RenderTexture const&, sf::Vector2<float> const&, int, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:623: undefined reference to `__imp__ZNK2sf13RenderTexture10getTextureEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:623: undefined reference to `__imp__ZNK2sf7Texture15getNativeHandleEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::ImageButton(sf::Sprite const&, int, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:635: undefined reference to `__imp__ZNK2sf6Sprite15getGlobalBoundsEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `ImGui::ImageButton(sf::Sprite const&, sf::Vector2<float> const&, int, sf::Color const&, sf::Color const&)':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:642: undefined reference to `__imp__ZNK2sf6Sprite10getTextureEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:649: undefined reference to `__imp__ZNK2sf7Texture7getSizeEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:650: undefined reference to `__imp__ZNK2sf6Sprite14getTextureRectEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:655: undefined reference to `__imp__ZNK2sf7Texture15getNativeHandleEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `getConnectedJoystickId':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:882: undefined reference to `__imp__ZN2sf8Joystick11isConnectedEj'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `updateJoystickActionState':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:914: undefined reference to `__imp__ZN2sf8Joystick15isButtonPressedEjj'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `updateJoystickDPadState':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:919: undefined reference to `__imp__ZN2sf8Joystick15getAxisPositionEjNS0_4AxisE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:922: undefined reference to `__imp__ZN2sf8Joystick15getAxisPositionEjNS0_4AxisE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `updateJoystickLStickState':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:933: undefined reference to `__imp__ZN2sf8Joystick15getAxisPositionEjNS0_4AxisE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:936: undefined reference to `__imp__ZN2sf8Joystick15getAxisPositionEjNS0_4AxisE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `setClipboardText':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:957: undefined reference to `__imp__ZN2sf9Clipboard9setStringERKNS_6StringE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `getClipboardText':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:961: undefined reference to `__imp__ZN2sf9Clipboard9getStringEv'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:961: undefined reference to `__imp__ZNK2sf6String6toUtf8B5cxx11Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `loadMouseCursor':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:967: undefined reference to `__imp__ZN2sf6CursorC1Ev'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:969: undefined reference to `__imp__ZN2sf6Cursor14loadFromSystemENS0_4TypeE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `updateMouseCursor':
D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:977: undefined reference to `__imp__ZN2sf6Window21setMouseCursorVisibleEb'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:979: undefined reference to `__imp__ZN2sf6Window21setMouseCursorVisibleEb'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\Projects\c++\sfml_imgui/./imgui/src/imgui-SFML.cpp:983: undefined reference to `__imp__ZN2sf6Window14setMouseCursorERKNS_6CursorE'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: imgui-SFML.o: in function `sf::String sf::String::fromUtf8<char const*>(char const*, char const*)':
D:\Projects\c++\sfml_imgui/./libraries/include/SFML/System/String.inl:30: undefined reference to `__imp__ZN2sf6StringC1Ev'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:8: all] Error 1
Note: All the object files(.o) are generated successfully
If you need more details please do ask

Related

Linkage errors when using SWIG, protobuf

I'm trying to use SWIG so that I can call C++ code from Go.
I want to use SWIG so that it can generate me wrapper code. The C++ code in question is generated by the protobuf compiler.
I have two hello.i files hello.i and protobuf.i:
protbuf.i
#define GOOGLE_PROTOBUF_VERSION 3021008
#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3021000
hello.i
%module example
%include "protobuf.i"
%{
#include "hello.pb.h"
#include "hello.gen.h"
%}
#include "hello.pb.h"
#include "hello.gen.h"
namespace example {
void handle_Person(example::Person& m, unsigned char* friends);
}
I am able to compile this with the SWIG command swig -go -cgo -c++ hello.i and it generates Go and _wrap.cc file.
Then I create a shared library with the following sequence of commands:
g++ -fPIC -c hello_wrap.cxx hello.pb.cc hello.gen.cc -ldl -lprotobuf -lprotoc -L${MY_PROJECT}/protobuf -L${MY_PROJECT}/protobuf/third_party/abseil-cpp/absl -L${MY_PROJECT}/protobuf/third_party/utf8_range
g++ -shared -o libhellowrap.so hello_wrap.o hello.gen.o hello.pb.o -ldl -lprotobuf -lprotoc -L${MY_PROJECT}/protobuf -L${MY_PROJECT}/protobuf/third_party/abseil-cpp/absl -L${MY_PROJECT}/protobuf/third_party/utf8_range
Now I want to use this in Go so I create a main.go file:
package main
/*
#cgo CFLAGS: -I/my_project/example
#cgo LDFLAGS: -L/my_project/example -lhellowrap -ldl -lstdc++
#include <stdlib.h>
*/
import (
"C"
"fmt"
"my_project/example"
)
func main() {
var p example.SwigcptrExample_Person
p = example.SwigcptrExample_Person(uintptr(int32(2000)))
friends := make([]byte, 5)
example.Handle_Person(p, &friends[0])
fmt.Println("New Friends: ", friends)
}
Then I run this main.go file and the following linkage errors occur:
# command-line-arguments
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/usr/local/include/google/protobuf/metadata_lite.h:183: undefined reference to `void google::protobuf::internal::InternalMetadata::DoMergeFrom<google::protobuf::UnknownFieldSet>(google::protobuf::UnknownFieldSet const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/usr/local/include/google/protobuf/io/coded_stream.h:674: undefined reference to `google::protobuf::io::EpsCopyOutputStream::EnsureSpaceFallback(unsigned char*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/parse_context.h:567: undefined reference to `google::protobuf::internal::VarintParseSlow32(char const*, unsigned int)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/usr/local/include/google/protobuf/parse_context.h:239: undefined reference to `google::protobuf::internal::EpsCopyInputStream::DoneFallback(int, int)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/my_project/example/hello.pb.cc:198: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/parse_context.h:658: undefined reference to `google::protobuf::internal::ReadTagFallback(char const*, unsigned int)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/usr/local/include/google/protobuf/metadata_lite.h:159: undefined reference to `google::protobuf::UnknownFieldSet* google::protobuf::internal::InternalMetadata::mutable_unknown_fields_slow<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/usr/local/include/google/protobuf/message.h:245: undefined reference to `vtable for google::protobuf::Message'
/usr/local/include/google/protobuf/message.h:245: undefined reference to `google::protobuf::MessageLite::~MessageLite()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/usr/local/include/google/protobuf/metadata_lite.h:113: undefined reference to `google::protobuf::Arena* google::protobuf::internal::InternalMetadata::DeleteOutOfLineHelper<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person()':
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool)':
/usr/local/include/google/protobuf/message_lite.h:432: undefined reference to `vtable for google::protobuf::MessageLite'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool)':
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::operator<<(char const*)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogFinisher::operator=(google::protobuf::internal::LogMessage&)'
/usr/local/include/google/protobuf/metadata_lite.h:78: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(example::Person const&)':
/usr/local/include/google/protobuf/metadata_lite.h:183: undefined reference to `void google::protobuf::internal::InternalMetadata::DoMergeFrom<google::protobuf::UnknownFieldSet>(google::protobuf::UnknownFieldSet const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person* google::protobuf::Arena::CreateMaybeMessage<example::Person>(google::protobuf::Arena*)':
/usr/local/include/google/protobuf/arena.h:309: undefined reference to `google::protobuf::Arena::Allocate(unsigned long)'
/tmp/go-link-96276495/000017.o: In function `example::Person::Clear()':
/usr/local/include/google/protobuf/metadata_lite.h:190: undefined reference to `void google::protobuf::internal::InternalMetadata::DoClear<google::protobuf::UnknownFieldSet>()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/my_project/example/hello.pb.cc:228: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
/tmp/go-link-96276495/000017.o: In function `example::Person::ByteSizeLong() const':
/my_project/example/hello.pb.cc:250: undefined reference to `google::protobuf::Message::MaybeComputeUnknownFieldsSize(unsigned long, google::protobuf::internal::CachedSize*) const'
/tmp/go-link-96276495/000017.o: In function `example::Person::GetMetadata() const':
/my_project/example/hello.pb.cc:297: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20220623::once_flag*, google::protobuf::Metadata const&)'
/tmp/go-link-96276495/000017.o: In function `example::Person::MergeImpl(google::protobuf::Message&, google::protobuf::Message const&)':
/my_project/example/hello.pb.cc:265: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::_InternalParse(char const*, google::protobuf::internal::ParseContext*) [clone .cold.25]':
/usr/local/include/google/protobuf/parse_context.h:228: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/usr/local/include/google/protobuf/parse_context.h:231: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::~Person() [clone .cold.26]':
/my_project/example/hello.pb.cc:153: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(google::protobuf::Arena*, bool) [clone .cold.27]':
/my_project/example/hello.pb.cc:143: undefined reference to `google::protobuf::internal::LogMessage::~LogMessage()'
/tmp/go-link-96276495/000017.o: In function `example::Person::Person(example::Person const&) [clone .cold.28]':
/usr/local/include/google/protobuf/message.h:245: undefined reference to `vtable for google::protobuf::Message'
/usr/local/include/google/protobuf/message.h:245: undefined reference to `google::protobuf::MessageLite::~MessageLite()'
/tmp/go-link-96276495/000017.o: In function `_GLOBAL__sub_I.00102_hello.pb.cc':
/my_project/example/hello.pb.cc:105: undefined reference to `google::protobuf::internal::AddDescriptorsRunner::AddDescriptorsRunner(google::protobuf::internal::DescriptorTable const*)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTIN7example6PersonE[_ZTIN7example6PersonE]+0x10): undefined reference to `typeinfo for google::protobuf::Message'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x20): undefined reference to `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x40): undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x48): undefined reference to `google::protobuf::Message::CheckTypeAndMergeFrom(google::protobuf::MessageLite const&)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x78): undefined reference to `google::protobuf::Message::MergeFrom(google::protobuf::Message const&)'
/tmp/go-link-96276495/000017.o:(.data.rel.ro._ZTVN7example6PersonE[_ZTVN7example6PersonE]+0x80): undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
/tmp/go-link-96276495/000017.o:(.data.rel.ro+0x0): undefined reference to `google::protobuf::Message::CopyWithSourceCheck(google::protobuf::Message&, google::protobuf::Message const&)'
/tmp/go-link-96276495/000018.o: In function `example::handle_Person(example::Person&, unsigned char*)':
/my_project/example/hello.gen.cc:14: undefined reference to `dlopen'
/my_project/example/hello.gen.cc:25: undefined reference to `dlsym'
/my_project/example/hello.gen.cc:26: undefined reference to `dlerror'
/my_project/example/hello.gen.cc:29: undefined reference to `dlclose'
/my_project/example/hello.gen.cc:16: undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
I have various things when trying to solve this problem but it feels like I'm missing a crucial step.

makefile example to use soplex

I'm trying to link soplex (the infinite precision LP solver of SCIP) in my C/C++ code. I managed to install soplex in my linux machine and from the command line it works.
My problem is that I do not manage to link it in my code:
I'm currently using a normal makefile in which I've put:
#sopleX HERE
SOPLEX_DIR = /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib
SOPLEX_INCLUDE= /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/src
LP_LIBS = -L/usr/lib/x86_64-linux-gnu/ -lgmp -L$(CPLEXLIBDIR) -lilocplex -lcplex -lm -lpthread -ldl -frounding-math -L$(GRBLIBDIR) -lgurobi90 -L$(SOPLEX_DIR) -lsoplex
DBG= -O3 -DIL_STD
INCDIR = -I. -I$(LP_INCLUDE) -I/usr/local/include -I$(GRB_LP_INCLUDE) -I$(SOPLEX_INCLUDE)
CXXFLAGS = $(DBG) $(INCDIR)
.c.o:
gcc -c $(CXXFLAGS) $< -o $#
#LDLIBS = $(CONCORDE_LIBS) $(MY_LIBS) $(LP_LIBS)
#LDLIBS = $(CONCORDE_LIBS) $(LP_LIBS)
LDLIBS = $(LP_LIBS)
all:BPPS
BPPS: $(OBJS)
$(CXX) $(CXXFLAGS) -o $# $(OBJS) $(LDLIBS)
$(OBJS): Makefile
clean:
rm -f $(OBJS) rm BPPS
but when I try to compile it gives me a series of errors:
g++ -O3 -DIL_STD -I. -I/home/fabio/ILOG/CPLEX_Studio_AcademicResearch129/cplex/include/ilcplex -I/usr/local/include -I/home/fabio/GUROBI/gurobi903/linux64/include -I/home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/src -o BPPS src/Main.o src/DP.o src/DP_LEX.o src/BPPS_BP_MASTER.o src/BPPS_BP_PRICER.o src/BPPS_BP_TREE.o src/BPPS_BP_TRIPLETS.o src/BPPS_BP_DIVING.o src/BPPS_BP_LP_HEUR.o src/BPPS_BP_SP_HEUR.o src/BPPS_BP_MAPPING.o src/REDUCTIONS.o src/preprocessing.o src/global_functions.o source/errors.o source/dp_master.o source/heap.o source/mckpsc-ls.o source/sort.o source/tools.o src/BPPS_FORM_B.o src/BPPS_FORM_A.o -L/usr/lib/x86_64-linux-gnu/ -lgmp -L/home/fabio/ILOG/CPLEX_Studio_AcademicResearch129/cplex/lib/x86-64_linux/static_pic -lilocplex -lcplex -lm -lpthread -ldl -frounding-math -L/home/fabio/GUROBI/gurobi903/linux64/lib -lgurobi90 -L/home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib -lsoplex
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::~Rational()':
rational.cpp:(.text+0x44): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::freeListMem()':
rational.cpp:(.text+0x138): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0x157): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::disableListMem()':
rational.cpp:(.text+0x1f8): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0x217): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(soplex::Rational const&)':
rational.cpp:(.text+0x2a0): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(long double const&)':
rational.cpp:(.text+0x2ec): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x30c): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x32c): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x34b): undefined reference to `__gmpq_set_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(double const&)':
rational.cpp:(.text+0x398): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3b2): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3ca): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x3d9): undefined reference to `__gmpq_set_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(int const&)':
rational.cpp:(.text+0x413): undefined reference to `__gmpq_set_si'
/usr/bin/ld: rational.cpp:(.text+0x428): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x440): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x458): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator=(__mpq_struct const (&) [1])':
rational.cpp:(.text+0x47d): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator double() const':
rational.cpp:(.text+0x4aa): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x4bd): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator long double() const':
rational.cpp:(.text+0x51e): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x531): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x53d): undefined reference to `__gmpq_get_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator float() const':
rational.cpp:(.text+0x59e): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x5b9): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x5cd): undefined reference to `__gmpq_get_d'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator+=(soplex::Rational const&)':
rational.cpp:(.text+0x641): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x654): undefined reference to `__gmpq_add'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator-=(soplex::Rational const&)':
rational.cpp:(.text+0x681): undefined reference to `__gmpq_sub'
/usr/bin/ld: rational.cpp:(.text+0x694): undefined reference to `__gmpq_set'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator*=(soplex::Rational const&)':
rational.cpp:(.text+0x6e2): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x6f1): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x707): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x716): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x72a): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x753): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x76f): undefined reference to `__gmpq_set'
/usr/bin/ld: rational.cpp:(.text+0x782): undefined reference to `__gmpq_mul'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::operator/=(soplex::Rational const&)':
rational.cpp:(.text+0x7c0): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7d6): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7e5): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x7f4): undefined reference to `__gmpq_equal'
/usr/bin/ld: rational.cpp:(.text+0x806): undefined reference to `__gmpq_div'
/usr/bin/ld: rational.cpp:(.text+0x827): undefined reference to `__gmpq_inv'
/usr/bin/ld: rational.cpp:(.text+0x84f): undefined reference to `__gmpq_inv'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::invert()':
rational.cpp:(.text+0x870): undefined reference to `__gmpq_inv'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::powRound()':
rational.cpp:(.text+0x8a5): undefined reference to `__gmpz_init'
/usr/bin/ld: rational.cpp:(.text+0x8b5): undefined reference to `__gmpz_cdiv_q'
/usr/bin/ld: rational.cpp:(.text+0x8c5): undefined reference to `__gmpz_sub_ui'
/usr/bin/ld: rational.cpp:(.text+0x8d2): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x8e2): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0x8ee): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0x8f6): undefined reference to `__gmpz_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::isAdjacentTo(double const&) const':
rational.cpp:(.text+0x94b): undefined reference to `__gmpq_get_d'
/usr/bin/ld: rational.cpp:(.text+0x959): undefined reference to `__gmpq_init'
/usr/bin/ld: rational.cpp:(.text+0x96b): undefined reference to `__gmpq_set_d'
/usr/bin/ld: rational.cpp:(.text+0x976): undefined reference to `__gmpq_cmp'
/usr/bin/ld: rational.cpp:(.text+0x980): undefined reference to `__gmpq_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::Rational::sizeInBase(int) const':
rational.cpp:(.text+0xa92): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xaa1): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::readStringRational(char const*, soplex::Rational&)':
rational.cpp:(.text+0xb2e): undefined reference to `__gmpq_set_str'
/usr/bin/ld: rational.cpp:(.text+0xb6d): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xba2): undefined reference to `__gmpz_init'
/usr/bin/ld: rational.cpp:(.text+0xbaa): undefined reference to `__gmpq_init'
/usr/bin/ld: rational.cpp:(.text+0xc99): undefined reference to `__gmpq_set_str'
/usr/bin/ld: rational.cpp:(.text+0xcaa): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xcd8): undefined reference to `__gmpq_canonicalize'
/usr/bin/ld: rational.cpp:(.text+0xce0): undefined reference to `__gmpz_clear'
/usr/bin/ld: rational.cpp:(.text+0xce8): undefined reference to `__gmpq_clear'
/usr/bin/ld: rational.cpp:(.text+0xdfb): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0xe06): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0xe15): undefined reference to `__gmpq_mul'
/usr/bin/ld: rational.cpp:(.text+0xe82): undefined reference to `__gmpz_ui_pow_ui'
/usr/bin/ld: rational.cpp:(.text+0xe8d): undefined reference to `__gmpq_set_z'
/usr/bin/ld: rational.cpp:(.text+0xe9c): undefined reference to `__gmpq_div'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<<(std::ostream&, soplex::Rational const&)':
rational.cpp:(.text+0xede): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xeef): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0xf0c): undefined reference to `__gmpq_get_str'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator==(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xf7f): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator!=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xf9f): undefined reference to `__gmpq_equal'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfbf): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator<=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfdf): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator>(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0xfff): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::operator>=(soplex::Rational const&, soplex::Rational const&)':
rational.cpp:(.text+0x101f): undefined reference to `__gmpq_cmp'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::totalSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x108e): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x109d): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::dlcmSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x1103): undefined reference to `__gmpz_init_set_ui'
/usr/bin/ld: rational.cpp:(.text+0x1132): undefined reference to `__gmpz_lcm'
/usr/bin/ld: rational.cpp:(.text+0x1142): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: rational.cpp:(.text+0x114d): undefined reference to `__gmpz_clear'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::dmaxSizeRational(soplex::Rational const*, int, int)':
rational.cpp:(.text+0x11b2): undefined reference to `__gmpz_sizeinbase'
/usr/bin/ld: /home/fabio/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid/lib/libsoplex.a(rational.cpp.o): in function `soplex::rationalToString[abi:cxx11](soplex::Rational const&, int)':
rational.cpp:(.text+0x1245): undefined reference to `__gmpf_init2'
/usr/bin/ld: rational.cpp:(.text+0x1251): undefined reference to `__gmpf_set_q'
/usr/bin/ld: rational.cpp:(.text+0x1267): undefined reference to `__gmpf_out_str'
/usr/bin/ld: rational.cpp:(.text+0x1274): undefined reference to `__gmpf_clear'
/usr/bin/ld:
[.....]
I think that there must be a problem linking the libraries of gmp, can anybody please help me?
The library gmp is here:
fabio#canarino3:~/Dropbox/WORKING/SETUP_BPP_CODE/soplex-5.0.1/buid$ grep gmp soplex-targets.cmake
INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libgmp.so;/usr/lib/x86_64-linux-gnu/libgmpxx.so;quadmath"
INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libgmp.so;/usr/lib/x86_64-linux-gnu/libgmpxx.so;quadmath"
I've built soplex from source, dowloaded from the scip webpage
Do you have an example of makefile in which soplex is linked?
MANY THANKS!!!!

Undefined Reference when OpenCV libraries cross compiled in Eclipse for Raspberry Pi

I am cross-compiling OpenCV libraries (2.4.9) and Raspicam (0.1.3) in Eclipse CDT IDE for Raspberry Pi. I am trying to compile a basic application that looks as the following:
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
#include <raspicam.h>
#include <raspicam_cv.h>
using namespace std;
using namespace cv;
int main()
{
....
namedWindow(output_window_name, CV_WINDOW_AUTOSIZE);
namedWindow(grayscale_window_name, 100);
namedWindow(thresholded_window_name, 100);
namedWindow(contours_window_name, 100);
moveWindow(grayscale_window_name, 20,20);
moveWindow(thresholded_window_name, 20, 250);
moveWindow(contours_window_name, 20, 600);
vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
compression_params.push_back(100);
raspicam::RaspiCam_Cv Camera;
....
}
To compile I made sure that libopencv_*.so files are in the cross compilation sysroot and linked in Eclipse using -l flags such as -lopencv_core -lopencv_highgui etc. I also included every include/ folder in sources using -I flag in Eclipse Build Settings.
Inclusion using #include and namespace declarations do not result in any errors.
Target building looks like this in the console:
arm-linux-gnueabihf-g++
-L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\usr\lib"
-L"C:/SysGCC/Raspberry/arm-linux-gnueabihf/sysroot/usr/lib/arm-linux-gnueabihf"
-L"C:\rpi-eclipse\workspace\RaspberryTest\libbluetooth"
-L"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\lib"
-Wl,-rpath-link,"C:\SysGCC\Raspberry\arm-linux-gnueabihf\sysroot\lib\arm-linux-gnueabihf"
-o "RaspberryTest" ./src/<ALL OBJS>
-lwiringPi
-lopencv_calib3d
-lopencv_core
-lopencv_features2d
-lopencv_flann
-lopencv_highgui
-lopencv_imgproc
-lopencv_ml
-lopencv_objdetect
-lopencv_video
-lbluetooth
-lpthread
-lwiringPiDev
However, the following errors are there:
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:115: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:116: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:117: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:118: undefined reference to `cv::namedWindow(std::string const&, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:120: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:121: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:122: undefined reference to `cv::moveWindow(std::string const&, int, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:129: undefined reference to `raspicam::RaspiCam_Cv::RaspiCam_Cv()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:131: undefined reference to `raspicam::RaspiCam_Cv::open()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:194: undefined reference to `raspicam::RaspiCam_Cv::grab()'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:195: undefined reference to `raspicam::RaspiCam_Cv::retrieve(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:208: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:208: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:211: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:211: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:215: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:215: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:219: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:219: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:220: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:224: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:224: undefined reference to `cv::floodFill(cv::_OutputArray const&, cv::Point_<int>, cv::Scalar_<double>, cv::Rect_<int>*, cv::Scalar_<double>, cv::Scalar_<double>, int)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:228: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:228: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:233: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:233: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:238: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:238: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:240: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:240: undefined reference to `cv::findContours(cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)'
C:\rpi-eclipse\workspace\RaspberryTest\Debug/../src/tasks/image_processing_task.cpp:129: undefined reference to `raspicam::RaspiCam_Cv::~RaspiCam_Cv()'
./src/tasks/image_processing_task.o: In function `cv::Mat::clone() const':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:335: undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray(cv::Scalar_<double> const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1137: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Point_<int> >(std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1145: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Vec<int, 4> >(std::vector<cv::Vec<int, 4>, std::allocator<cv::Vec<int, 4> > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1143: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Point_<int> >(std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1122: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_OutputArray::_OutputArray<cv::Point_<int> >(std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1143: undefined reference to `vtable for cv::_OutputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Point_<int> >(std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1125: undefined reference to `vtable for cv::_InputArray'
./src/tasks/image_processing_task.o: In function `cv::_InputArray::_InputArray<cv::Vec<int, 4> >(std::vector<cv::Vec<int, 4>, std::allocator<cv::Vec<int, 4> > > const&)':
C:\rpi-eclipse\workspace\RaspberryTest\opencv-2.4.9\modules\core\include/opencv2/core/mat.hpp:1122: undefined reference to `vtable for cv::_InputArray'
collect2.exe: error: ld returned 1 exit status
make: *** [RaspberryTest] Error 1
This indicates that I have two type of errors.
1-) undefined reference (for functions)
2-) undefined reference to vtable` (Related to virtual functions I believe)
In order to overcome this problem, I feel like I have to change STL/C standards, but do not know what to do exactly. Also, the fact that libraries are compiled and included correctly but there are still undefined references is really weird to me.
Any guidance regarding how to solve this problem is greately appreciated.
Thanks in advance.

Undefined symbol references in boost and CImg

I am new to using CImg and boost. I am getting undefined symbol references as mentioned below, in the code also shared below.
I am using this command line to build it: g++ -lboost_filesystem -lboost_system -L/usr/X11R6/lib -lm -lpthread -lX11 grayscaleConvertor.cpp &> errLog.txt
I am using the -l args in the compiler command. eg: -lboost_filesystem which I read on another post in stackoverflow, but that is not helping resolve the boost::filesystem:: symbols
locate CImg : /usr/include/CImg.h
locate boost: /usr/include/boost (plus more lines)
errLog.txt
/tmp/ccRIIPim.o: In function main':
grayscaleConvertor.cpp:(.text+0x179): undefined reference toboost::filesystem::path::extension() const'
grayscaleConvertor.cpp:(.text+0x213): undefined reference to boost::filesystem::path::filename() const'
/tmp/ccRIIPim.o: In function__static_initialization_and_destruction_0(int, int)':
grayscaleConvertor.cpp:(.text+0x68e): undefined reference to boost::system::generic_category()'
grayscaleConvertor.cpp:(.text+0x698): undefined reference toboost::system::generic_category()'
grayscaleConvertor.cpp:(.text+0x6a2): undefined reference to boost::system::system_category()'
/tmp/ccRIIPim.o: In functionboost::system::error_code::error_code()':
grayscaleConvertor.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x10): undefined reference to boost::system::system_category()'
/tmp/ccRIIPim.o: In functionboost::system::error_code::clear()':
grayscaleConvertor.cpp:(.text._ZN5boost6system10error_code5clearEv[_ZN5boost6system10error_code5clearEv]+0x10): undefined reference to boost::system::system_category()'
/tmp/ccRIIPim.o: In functionboost::filesystem::path::compare(std::__cxx11::basic_string, std::allocator > const&) const':
grayscaleConvertor.cpp:(.text._ZNK5boost10filesystem4path7compareERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZNK5boost10filesystem4path7compareERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x3b): undefined reference to boost::filesystem::path::compare(boost::filesystem::path const&) const'
/tmp/ccRIIPim.o: In functionboost::filesystem::exists(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x24): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::is_directory(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x24): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::is_regular_file(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x24): undefined reference to boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_entry::status(boost::system::error_code&) const':
grayscaleConvertor.cpp:(.text._ZNK5boost10filesystem15directory_entry6statusERNS_6system10error_codeE[_ZNK5boost10filesystem15directory_entry6statusERNS_6system10error_codeE]+0x31): undefined reference to boost::filesystem::directory_entry::m_get_status(boost::system::error_code*) const'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_entry::symlink_status(boost::system::error_code&) const':
grayscaleConvertor.cpp:(.text._ZNK5boost10filesystem15directory_entry14symlink_statusERNS_6system10error_codeE[_ZNK5boost10filesystem15directory_entry14symlink_statusERNS_6system10error_codeE]+0x31): undefined reference to boost::filesystem::directory_entry::m_get_symlink_status(boost::system::error_code*) const'
/tmp/ccRIIPim.o: In functionboost::filesystem::detail::dir_itr_imp::~dir_itr_imp()':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem6detail11dir_itr_impD2Ev[_ZN5boost10filesystem6detail11dir_itr_impD5Ev]+0x2e): undefined reference to boost::filesystem::detail::dir_itr_close(void*&, void*&)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem18directory_iteratorC2ERKNS0_4pathE[_ZN5boost10filesystem18directory_iteratorC5ERKNS0_4pathE]+0x4a): undefined reference to boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_iterator::directory_iterator(boost::filesystem::path const&, boost::system::error_code&)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem18directory_iteratorC2ERKNS0_4pathERNS_6system10error_codeE[_ZN5boost10filesystem18directory_iteratorC5ERKNS0_4pathERNS_6system10error_codeE]+0x4b): undefined reference to boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functionboost::filesystem::directory_iterator::increment()':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem18directory_iterator9incrementEv[_ZN5boost10filesystem18directory_iterator9incrementEv]+0xf): undefined reference to boost::filesystem::detail::directory_iterator_increment(boost::filesystem::directory_iterator&, boost::system::error_code*)'
/tmp/ccRIIPim.o: In functioncimg_library::cimg::Mutex_info::trylock(unsigned int)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library4cimg10Mutex_info7trylockEj[_ZN12cimg_library4cimg10Mutex_info7trylockEj]+0x1c): undefined reference to pthread_mutex_trylock'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::screen_width()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay12screen_widthEv[_ZN12cimg_library11CImgDisplay12screen_widthEv]+0x26): undefined reference to XOpenDisplay'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay12screen_widthEv[_ZN12cimg_library11CImgDisplay12screen_widthEv]+0x96): undefined reference toXCloseDisplay'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::screen_height()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay13screen_heightEv[_ZN12cimg_library11CImgDisplay13screen_heightEv]+0x26): undefined reference toXOpenDisplay'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay13screen_heightEv[_ZN12cimg_library11CImgDisplay13screen_heightEv]+0x96): undefined reference to XCloseDisplay'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_handle_events(_XEvent const*)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0xb5): undefined reference to XUnmapWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x112): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x1f0): undefined reference to XResizeWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x2c2): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x317): undefined reference to XGetWindowAttributes'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x335): undefined reference toXSync'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x356): undefined reference to XSetInputFocus'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x472): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x5c4): undefined reference to XCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x601): undefined reference toXLookupString'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x635): undefined reference to XQueryKeymap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x6d8): undefined reference toXLookupString'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x71b): undefined reference to XCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x7f0): undefined reference toXCheckWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent[_ZN12cimg_library11CImgDisplay14_handle_eventsEPK7_XEvent]+0x861): undefined reference to XCheckWindowEvent'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_events_thread(void*)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_events_threadEPv[_ZN12cimg_library11CImgDisplay14_events_threadEPv]+0x6a): undefined reference to XCheckTypedEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_events_threadEPv[_ZN12cimg_library11CImgDisplay14_events_threadEPv]+0x94): undefined reference toXCheckMaskEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay14_events_threadEPv[_ZN12cimg_library11CImgDisplay14_events_threadEPv]+0x14c): undefined reference to pthread_testcancel'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_set_colormap(unsigned long&, unsigned int)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay13_set_colormapERmj[_ZN12cimg_library11CImgDisplay13_set_colormapERmj]+0x2a2): undefined reference to XStoreColors'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_map_window()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0x50): undefined reference to XMapRaised'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0x74): undefined reference toXWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0xcb): undefined reference to XGetWindowAttributes'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay11_map_windowEv[_ZN12cimg_library11CImgDisplay11_map_windowEv]+0xe9): undefined reference toXSync'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::_paint(bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6_paintEb[_ZN12cimg_library11CImgDisplay6_paintEb]+0xcd): undefined reference toXSendEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6_paintEb[_ZN12cimg_library11CImgDisplay6_paintEb]+0x130): undefined reference to XPutImage'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_init_fullscreen()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0xfe): undefined reference to XCreateWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x1df): undefined reference toXCreateImage'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x208): undefined reference to XSelectInput'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x226): undefined reference toXMapRaised'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x24a): undefined reference to XWindowEvent'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x2c1): undefined reference toXPutImage'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x2e6): undefined reference to XGetWindowAttributes'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay16_init_fullscreenEv[_ZN12cimg_library11CImgDisplay16_init_fullscreenEv]+0x304): undefined reference toXSync'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::_desinit_fullscreen()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv[_ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv]+0x28): undefined reference toXUngrabKeyboard'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv[_ZN12cimg_library11CImgDisplay19_desinit_fullscreenEv]+0x4d): undefined reference to XDestroyWindow'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::_assign(unsigned int, unsigned int, char const*, unsigned int, bool, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0xf7): undefined reference to XOpenDisplay'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x330): undefined reference toXVisualIDFromVisual'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x34b): undefined reference to XGetVisualInfo'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x392): undefined reference toXFree'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x3d2): undefined reference to pthread_create'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x57c): undefined reference toXCreateWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x5e3): undefined reference to XCreateSimpleWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x614): undefined reference toXSelectInput'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x650): undefined reference to XStoreName'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x6ab): undefined reference toXCreateColormap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x703): undefined reference to XSetWindowColormap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x70b): undefined reference toXAllocClassHint'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x741): undefined reference to XSetClassHint'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x74f): undefined reference toXFree'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x84a): undefined reference to XCreateImage'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x870): undefined reference toXInternAtom'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x896): undefined reference to XInternAtom'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x8ce): undefined reference toXSetWMProtocols'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb[_ZN12cimg_library11CImgDisplay7_assignEjjPKcjbb]+0x902): undefined reference to XGrabKeyboard'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::assign()':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6assignEv[_ZN12cimg_library11CImgDisplay6assignEv]+0x10c): undefined reference to XDestroyWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6assignEv[_ZN12cimg_library11CImgDisplay6assignEv]+0x17b): undefined reference toXFreeColormap'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6assignEv[_ZN12cimg_library11CImgDisplay6assignEv]+0x198): undefined reference to XSync'
/tmp/ccRIIPim.o: In functioncimg_library::CImgDisplay::resize(int, int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6resizeEiib[_ZN12cimg_library11CImgDisplay6resizeEiib]+0x208): undefined reference to XResizeWindow'
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay6resizeEiib[_ZN12cimg_library11CImgDisplay6resizeEiib]+0x227): undefined reference toXGetWindowAttributes'
/tmp/ccRIIPim.o: In function cimg_library::CImgDisplay::move(int, int)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay4moveEii[_ZN12cimg_library11CImgDisplay4moveEii]+0x72): undefined reference toXMoveWindow'
/tmp/ccRIIPim.o: In function void cimg_library::CImgDisplay::_resize<unsigned char>(unsigned char, unsigned int, unsigned int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_resizeIhEEvT_jjb[_ZN12cimg_library11CImgDisplay7_resizeIhEEvT_jjb]+0x106): undefined reference toXCreateImage'
/tmp/ccRIIPim.o: In function void cimg_library::CImgDisplay::_resize<unsigned short>(unsigned short, unsigned int, unsigned int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_resizeItEEvT_jjb[_ZN12cimg_library11CImgDisplay7_resizeItEEvT_jjb]+0x10b): undefined reference toXCreateImage'
/tmp/ccRIIPim.o: In function void cimg_library::CImgDisplay::_resize<unsigned int>(unsigned int, unsigned int, unsigned int, bool)':
grayscaleConvertor.cpp:(.text._ZN12cimg_library11CImgDisplay7_resizeIjEEvT_jjb[_ZN12cimg_library11CImgDisplay7_resizeIjEEvT_jjb]+0x106): undefined reference toXCreateImage'
/tmp/ccRIIPim.o: In function boost::filesystem::path::path<boost::filesystem::directory_entry>(boost::filesystem::directory_entry const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<boost::filesystem::directory_entry>::type>, void>::type*)':
grayscaleConvertor.cpp:(.text._ZN5boost10filesystem4pathC2INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC5INS0_15directory_entryEEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0x21): undefined reference toboost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string, std::allocator >&)'
collect2: error: ld returned 1 exit status
grayscaleConvertor.cpp
#define BOOST_FILESYSTEM_VERSION 3
#define BOOST_FILESYSTEM_NO_DEPRECATED
#include <boost/filesystem.hpp>
#include "CImg.h"
#include <iostream>
#include <string>
using namespace cimg_library;
using namespace std;
namespace fs = ::boost::filesystem;
int main()
{
const string ext = ".png";
fs::path root("/Downloads/testdata1/");
if(!fs::exists(root) || !fs::is_directory(root)) return -1;
fs::recursive_directory_iterator it(root);
fs::recursive_directory_iterator endit;
while(it != endit)
{
if(fs::is_regular_file(*it) && it->path().extension()==ext)
{
CImg<unsigned char> image(it->path().filename().string().c_str()),
gray(image.width(), image.height(), 1, 1, 0),
grayWeight(image.width(), image.height(), 1, 1, 0),
imgR(image.width(), image.height(), 1, 3, 0),
imgG(image.width(), image.height(), 1, 3, 0),
imgB(image.width(), image.height(), 1, 3, 0);
}
++it;
}
return 0;
}

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