Flatbuffers installation breaks tensorflow-lite

I am trying to use Tensorflow-lite to run inference on a video frame by frame. This is my code so far:

#include <iostream>
#include "src/VideoProcessing.h"
#include <cstdio>
#include <opencv2/opencv.hpp>
#include <opencv2/videoio.hpp>
#include "tensorflow/lite/interpreter.h"
#include "tensorflow/lite/kernels/register.h"
#include "tensorflow/lite/model_builder.h"
#include "tensorflow/lite/interpreter_builder.h"


int main() {
    int fps = VideoProcessing::getFPS("trainer.mp4");
    unsigned long size = VideoProcessing::getSize("trainer.mp4");
    cv::VideoCapture cap("trainer.mp4");

    //Check if input video exists
    if(!cap.isOpened()){
        std::cout<<"Error opening video stream or file"<<std::endl;
        return -1;
    }

    //Create a window to show input video
    cv::namedWindow("input video", cv::WINDOW_NORMAL);

    //Keep playing video until video is completed
    while(true){
        cv::Mat frame;

        //Capture frame by frame
        cap >> frame;

        //If frame is empty then break the loop
        if(frame.empty()){break;}

        //Show the current frame
        imshow("input video", frame);

    }

    //Close window after input video is completed
    cap.release();

    //Destroy all the opened windows
    cv::destroyAllWindows();

    std::cout << "Video file FPS: " << fps << std::endl;
    std::cout << "Video file size: " << size << std::endl;

    // Load the model
    std::unique_ptr<tflite::FlatBufferModel> model = tflite::FlatBufferModel::BuildFromFile("pose_landmark_full.tflite");

    // Build the interpreter
    tflite::ops::builtin::BuiltinOpResolver resolver;
    std::unique_ptr<tflite::Interpreter> interpreter;
    tflite::InterpreterBuilder(*model, resolver)(&interpreter);

    if (interpreter == nullptr)
    {
        fprintf(stderr, "Failed to initiate the interpreter\n");
        exit(-1);
    }

    return 0;
}

I use this command to run my project:

g++ -std=c++17 main.cpp src/VideoProcessing.cpp `pkg-config --libs --cflags opencv4` -o result

My tensorflow-lite is in /usr/local/include/tensorflow/lite/. Previously, the project required the flatbuffers installation but after successfully installing it, this became my output:

 g++ -std=c++17 main.cpp src/VideoProcessing.cpp `pkg-config --libs --cflags opencv4` -o result
/usr/bin/ld: /tmp/ccrIDCB2.o: warning: relocation against `_ZTVN6tflite17MutableOpResolverE' in read-only section `.text._ZN6tflite17MutableOpResolverD2Ev[_ZN6tflite17MutableOpResolverD5Ev]'
/usr/bin/ld: /tmp/ccrIDCB2.o: in function `main':
main.cpp:(.text+0x34c): undefined reference to `tflite::DefaultErrorReporter()'
/usr/bin/ld: main.cpp:(.text+0x368): undefined reference to `tflite::FlatBufferModel::BuildFromFile(char const*, tflite::ErrorReporter*)'
/usr/bin/ld: main.cpp:(.text+0x377): undefined reference to `tflite::ops::builtin::BuiltinOpResolver::BuiltinOpResolver()'
/usr/bin/ld: main.cpp:(.text+0x3af): undefined reference to `tflite::InterpreterBuilder::InterpreterBuilder(tflite::FlatBufferModel const&, tflite::OpResolver const&, tflite::InterpreterOptions const*)'
/usr/bin/ld: main.cpp:(.text+0x3c8): undefined reference to `tflite::InterpreterBuilder::operator()(std::unique_ptr<tflite::Interpreter, std::default_delete<tflite::Interpreter> >*)'
/usr/bin/ld: main.cpp:(.text+0x3d7): undefined reference to `tflite::InterpreterBuilder::~InterpreterBuilder()'
/usr/bin/ld: main.cpp:(.text+0x5b3): undefined reference to `tflite::InterpreterBuilder::~InterpreterBuilder()'
/usr/bin/ld: /tmp/ccrIDCB2.o: in function `tflite::MutableOpResolver::~MutableOpResolver()':
main.cpp:(.text._ZN6tflite17MutableOpResolverD2Ev[_ZN6tflite17MutableOpResolverD5Ev]+0x13): undefined reference to `vtable for tflite::MutableOpResolver'
/usr/bin/ld: /tmp/ccrIDCB2.o: in function `std::default_delete<tflite::FlatBufferModel>::operator()(tflite::FlatBufferModel*) const':
main.cpp:(.text._ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1_[_ZNKSt14default_deleteIN6tflite15FlatBufferModelEEclEPS1_]+0x22): undefined reference to `tflite::FlatBufferModel::~FlatBufferModel()'
/usr/bin/ld: /tmp/ccrIDCB2.o: in function `std::default_delete<tflite::Interpreter>::operator()(tflite::Interpreter*) const':
main.cpp:(.text._ZNKSt14default_deleteIN6tflite11InterpreterEEclEPS1_[_ZNKSt14default_deleteIN6tflite11InterpreterEEclEPS1_]+0x22): undefined reference to `tflite::Interpreter::~Interpreter()'
/usr/bin/ld: /tmp/ccrIDCB2.o:(.data.rel.ro._ZTVN6tflite3ops7builtin17BuiltinOpResolverE[_ZTVN6tflite3ops7builtin17BuiltinOpResolverE]+0x10): undefined reference to `tflite::MutableOpResolver::FindOp(tflite::BuiltinOperator, int) const'
/usr/bin/ld: /tmp/ccrIDCB2.o:(.data.rel.ro._ZTVN6tflite3ops7builtin17BuiltinOpResolverE[_ZTVN6tflite3ops7builtin17BuiltinOpResolverE]+0x18): undefined reference to `tflite::MutableOpResolver::FindOp(char const*, int) const'
/usr/bin/ld: /tmp/ccrIDCB2.o:(.data.rel.ro._ZTVN6tflite3ops7builtin17BuiltinOpResolverE[_ZTVN6tflite3ops7builtin17BuiltinOpResolverE]+0x48): undefined reference to `tflite::MutableOpResolver::MayContainUserDefinedOps() const'
/usr/bin/ld: /tmp/ccrIDCB2.o:(.data.rel.ro._ZTIN6tflite3ops7builtin17BuiltinOpResolverE[_ZTIN6tflite3ops7builtin17BuiltinOpResolverE]+0x10): undefined reference to `typeinfo for tflite::MutableOpResolver'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status