g++ 链接外部库时没有那个文件或目录

问题描述 投票:0回答:0

我正在在线学习 LearnCPP 教程,并且想知道如何安装 plog。据我了解,plog 是一个头文件库,只需将它物理添加到我正在处理的目录中就足够了,但无论我做什么添加,我总是以 an

fatal error: plog/Log.h: No such file or directory

我尝试使用 -I 参数,因为它应该包含目录中的头文件库,但到目前为止没有任何效果。我什至尝试了 -I 和 -L,尝试为库名称添加 -l,但无论我做什么都行不通。我怎样才能解决这个问题?这是我尝试运行时 VSCode 生成的 g++ 命令。

/usr/bin/g++ -fdiagnostics-color=always -g -pedantic-errors -Wall -Weffc++ -Wextra -Wsign-conversion -Werror -Iplog/include/plog -Lplog/include/plog -std=c++20 /home/dave/programs/cpp-learning/3debugging/hello.cpp -o /home/dave/programs/cpp-learning/3debugging/hello

这是我真正的 hello.cpp

#include <plog/Log.h> // Step 1: include the logger headers
#include <plog/Initializers/RollingFileInitializer.h>
#include <iostream>

int main() { 

}
c++ visual-studio-code g++
© www.soinside.com 2019 - 2024. All rights reserved.