Libraries not found VS Code

For pthread I am just using a basic code to check if it works first:

#include <iostream>
#include <pthread.h>

// Function executed by the thread
void *thread_func(void *arg) {
    int *p = static_cast<int*>(arg);
    std::cout << "Thread: Hello World! Argument passed: " << *p << std::endl;
    pthread_exit(NULL);
}

int main() {
    pthread_t thread;
    int arg = 42;

    // Create the thread
    if (pthread_create(&thread, NULL, thread_func, static_cast<void*>(&arg))) {
        std::cerr << "Error creating thread." << std::endl;
        return 1;
    }

    std::cout << "Main: Thread created with ID " << thread << std::endl;

    // Wait for the thread to finish
    if (pthread_join(thread, NULL)) {
        std::cerr << "Error joining thread." << std::endl;
        return 1;
    }

    std::cout << "Main: Thread finished." << std::endl;

    return 0;
}

The same thing I do for filesystem:

#include <iostream>
#include <filesystem>

int main() {
    // create a directory
    std::filesystem::create_directory("test_dir");
    
    // check if the directory exists
    if (std::filesystem::exists("test_dir")) {
        std::cout << "Directory created successfully!" << std::endl;
    } else {
        std::cout << "Error creating directory." << std::endl;
        return 1;
    }
    
    // create a file inside the directory
    std::ofstream("test_dir/test.txt");
    
    // check if the file exists
    if (std::filesystem::exists("test_dir/test.txt")) {
        std::cout << "File created successfully!" << std::endl;
    } else {
        std::cout << "Error creating file." << std::endl;
        return 1;
    }
    
    // remove the file
    std::filesystem::remove("test_dir/test.txt");
    
    // check if the file was removed
    if (!std::filesystem::exists("test_dir/test.txt")) {
        std::cout << "File removed successfully!" << std::endl;
    } else {
        std::cout << "Error removing file." << std::endl;
        return 1;
    }
    
    // remove the directory
    std::filesystem::remove("test_dir");
    
    // check if the directory was removed
    if (!std::filesystem::exists("test_dir")) {
        std::cout << "Directory removed successfully!" << std::endl;
    } else {
        std::cout << "Error removing directory." << std::endl;
        return 1;
    }
    
    return 0;
}

The configurations are as follows:
Dockerfile.sdk:

# ARGUMENTS --------------------------------------------------------------------
ARG CROSS_SDK_BASE_TAG=2.7-bullseye

##
# Board architecture
# arm or arm64
##
ARG IMAGE_ARCH=


# BUILD ------------------------------------------------------------------------
FROM torizon/debian-cross-toolchain-${IMAGE_ARCH}:${CROSS_SDK_BASE_TAG}

# __deps__
RUN apt-get -q -y update && \
    apt-get -q -y install \
    # ADD YOUR PACKAGES HERE
    && \
    apt-get clean && apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*
# __deps__

# automate for torizonPackages.json
RUN apt-get -q -y update && \
    apt-get -q -y install \
# DOES NOT REMOVE THIS LABEL: this is used for VS Code automation
    # __torizon_packages_dev_start__
    # __torizon_packages_dev_end__
# DOES NOT REMOVE THIS LABEL: this is used for VS Code automation
    && \
    apt-get clean && apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

Makefile:

# tool macros
CC := g++
CCFLAGS := -Iincludes/ 
DBGFLAGS := -g
LDFLAGS :=  
CCOBJFLAGS := $(CCFLAGS) -c
ARCH :=

# path macros
BIN_PATH := $(ARCH)/bin
OBJ_PATH := $(ARCH)/obj
SRC_PATH := src
DBG_PATH := $(ARCH)/debug

# compile macros
TARGET_NAME := pesho
TARGET := $(BIN_PATH)/$(TARGET_NAME)
TARGET_DEBUG := $(DBG_PATH)/$(TARGET_NAME)

# src files & obj files
SRC := $(foreach x, $(SRC_PATH), $(wildcard $(addprefix $(x)/*,.c*)))
OBJ := $(addprefix $(OBJ_PATH)/, $(addsuffix .o, $(notdir $(basename $(SRC)))))
OBJ_DEBUG := $(addprefix $(DBG_PATH)/, $(addsuffix .o, $(notdir $(basename $(SRC)))))

# clean files list
DISTCLEAN_LIST := $(OBJ) \
					$(OBJ_DEBUG)

CLEAN_LIST := $(TARGET) \
				$(TARGET_DEBUG) \
				$(DISTCLEAN_LIST)

# default rule
default: makedir all

# non-phony targets
$(TARGET): $(OBJ)
	$(CC) $(CCFLAGS) -o $@ $(OBJ) $(LDFLAGS)

$(OBJ_PATH)/%.o: $(SRC_PATH)/%.c*
	$(CC) $(CCOBJFLAGS) -o $@ $<

$(DBG_PATH)/%.o: $(SRC_PATH)/%.c*
	$(CC) $(CCOBJFLAGS) $(DBGFLAGS) -o $@ $<

$(TARGET_DEBUG): $(OBJ_DEBUG)
	$(CC) $(CCFLAGS) $(DBGFLAGS) $(OBJ_DEBUG) -o $@ $(LDFLAGS)

# phony rules
.PHONY: makedir
makedir:
	@mkdir -p $(BIN_PATH) $(OBJ_PATH) $(DBG_PATH)

.PHONY: all
all: $(TARGET)

.PHONY: debug
debug: $(TARGET_DEBUG)

.PHONY: clean
clean:
	@echo CLEAN $(CLEAN_LIST)
	@rm -f $(CLEAN_LIST)

.PHONY: distclean
distclean:
	@echo CLEAN $(CLEAN_LIST)
	@rm -f $(DISTCLEAN_LIST)

Dockerfile.debug:

# ARGUMENTS --------------------------------------------------------------------
##
# Board architecture
##
ARG IMAGE_ARCH=
# For armv7 use:
#ARG IMAGE_ARCH=arm

##
# Base container version
##
ARG BASE_VERSION=2.5-bullseye

##
# Application Name
##
ARG APP_EXECUTABLE=app

##
# Debug port
##
ARG SSH_DEBUG_PORT=

##
# Run as
##
ARG SSHUSERNAME=

# BUILD ------------------------------------------------------------------------
##
# Deploy Step
##
FROM --platform=linux/${IMAGE_ARCH} \
    torizonextras/debian:${BASE_VERSION} AS Debug

ARG IMAGE_ARCH
ARG SSH_DEBUG_PORT
ARG APP_EXECUTABLE
ARG SSHUSERNAME
ENV APP_EXECUTABLE ${APP_EXECUTABLE}

# SSH for remote debug
EXPOSE ${SSH_DEBUG_PORT}

# Make sure we don't get notifications we can't answer during building.
ENV DEBIAN_FRONTEND="noninteractive"

# your regular RUN statements here
# Install required packages
RUN apt-get -q -y update && \
    apt-get -q -y install \
    openssl \
    openssh-server \
    rsync \
    file \
    curl \
    gdb && \
    apt-get clean && apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*

# automate for torizonPackages.json
RUN apt-get -q -y update && \
    apt-get -q -y install \
# DOES NOT REMOVE THIS LABEL: this is used for VS Code automation
    # __torizon_packages_dev_start__
    # __torizon_packages_dev_end__
# DOES NOT REMOVE THIS LABEL: this is used for VS Code automation
    && \
    apt-get clean && apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*

# ⚠️ DEBUG PURPOSES ONLY!!
# copies RSA key to enable SSH login for user
COPY .conf/id_rsa.pub /id_rsa.pub

# create folders needed for the different components
# configures SSH access to the container and sets environment by default
RUN mkdir /var/run/sshd && \
    sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' \
        -i /etc/pam.d/sshd && \
    if test $SSHUSERNAME != root ; \
        then mkdir -p /home/$SSHUSERNAME/.ssh ; \
        else mkdir -p /root/.ssh ; fi && \
    if test $SSHUSERNAME != root ; \
        then cp /id_rsa.pub /home/$SSHUSERNAME/.ssh/authorized_keys ; \
        else cp /id_rsa.pub /root/.ssh/authorized_keys ; fi && \
    echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config && \
    echo "Port ${SSH_DEBUG_PORT}" >> /etc/ssh/sshd_config && \
    su -c "env" $SSHUSERNAME > /etc/environment

RUN rm -r /etc/ssh/ssh*key && \
    dpkg-reconfigure openssh-server

CMD [ "/usr/sbin/sshd", "-D" ]