首页 > 解决方案 > Visual Studio Code 编译运行时出现问题(路径错误)

问题描述

从今天早上开始,当我回到 C++ 的冷浴中时,我一直对 Visual Studio 代码非常有耐心。虽然一开始看起来不错,但当我尝试整理我的文件时,一切都变成了 S**T。

这是我的情况的描述

我有一个非常简单的乔木

Folder\header\thisHeader.h
Folder\source\thisHeader.cpp

thisHeader.h文件中,我们可以找到

#include <stdio.h>
#include <iostream>

int somefunction()
{
    printf("5 hours later, coffee did not work and hope is looking grim");
    return 0;
}

而在thisHeader.cpp文件中,我们有以下内容

#include "F/headers/thisHeader.h"
#include <stdio.h>
#include <iostream>

int main()
{
    somefunction();
}

运行这些相当简单的行会给我一个thisHeader.h的路径错误,即使它是所需的路径。我已经尝试将代码运行到一个文件中并且它确实可以编译。我很想得到一些帮助,因为坦率地说,这个问题让我浪费了一天的时间,尽管我确信它的答案非常简单。

我认为构成一些编译威胁的三件事是:

  1. 我的标题路径
  2. 我的文件组织(出于一些黑暗的原因?)
  3. 我该死的智商和生活选择

标签: windowsvisual-studio-codepathinclude

解决方案


推荐阅读