I'm having trouble understanding what's wrong with my linking to the include folder of spdlog in Visual Studio 2022

215 views Asked by At

I'm following The Cherno's series on Youtube and in the Logging episode he uses SPDLOG for a log of the actual Game Engine. He uses the #include "spdlog/spdlog.h" function to call the spdlog.h file into Log.h but I keep getting the error saying that it cannot access spdlog/spdlog.h

C:\Users\peyton\source\repos\Hazel2\Hazel\Hazel\src\Hazel\Log.h(5,10): fatal error C1083: Cannot open include file: 'spdlog': No such file or directory

//Log.h
#pragma once

#include <memory>
#include "Core.h"
#include "spdlog/spdlog.h"

namespace Hazel {
    class HAZEL_API Log
    {
    public:
        static void Init();

        inline static std::shared_ptr<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
        inline static std::shared_ptr<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }
    private:
        static std::shared_ptr<spdlog::logger> s_CoreLogger;
        static std::shared_ptr<spdlog::logger> s_ClientLogger;
    };
}

This is my code for the Log.h file if it helps. Also here's the file path for the spdlog folder and its include foler: C:\Users\peyton\source\repos\Hazel2\Hazel\Hazel\src\Hazel\vendor\spdlog-1.x\include What my linking looks like for the Addition Include Libraries incase maybe I did something wrong there.

I've already tried to relink the files and I've gone around to many different forums to see if other people have has this issue before. I'm kind of stuck and cant progress without getting past this problem. If someone could help me that would be great.

1

There are 1 answers

0
Minxin Yu - MSFT On

From your screenshot: xxx\include\spdlog

#include "spdlog/spdlog.h"

It means the compiler is looking for the xxx\include\spdlog\spdlog\spdlog.h file. Do you really have a file with such a path?

Please try adding additiaoinal include directory C:\Users\peyton\source\repos\Hazel2\Hazel\Hazel\src\Hazel\vendor\spdlog-1.x\include