简体   繁体   English

VSCode 包含路径 C++

[英]VSCode Include path C++

I am trying to learn C++, but I am having trouble.我正在尝试学习 C++,但我遇到了麻烦。 When trying to compile my source file, I receive the below error message for all of my header files.在尝试编译我的源文件时,我收到以下关于我的所有 header 文件的错误消息。

错误信息

I have tried adding multiple paths to my CPP properties file but am still having trouble identifying the problem.我尝试向我的 CPP 属性文件添加多个路径,但仍然无法识别问题。

在此处输入图像描述

Above is the properties file I previously mentioned.上面是我之前提到的属性文件。

在此处输入图像描述

Also, here is how my directory is set up.另外,这是我的目录的设置方式。 Any help is appreciated.任何帮助表示赞赏。

So as far as I am able to understand, you are trying to run main.cpp that has a user defined header file Book.h But Book.h is in another directory so, try using据我所知,您正在尝试运行具有用户定义的 header 文件 Book.h 但 Book.h 在另一个目录中的 main.cpp,因此请尝试使用

#include "../headers/Book.h"

Basically you need to give the location of Book.h file in respect to main.cpp基本上你需要给出 Book.h 文件相对于 main.cpp 的位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM