包括新文件夹中的头文件 "cannot open include file - no such file or directory"



我正在使用Microsoft Visual C++2010作为一个简单的控制台应用程序,但我在包含一个我想作为配置文件的头文件时遇到了问题

目录如下

-AI
  --config
    --config.h
  --Header Files
  --Resource Files
  --Source Files

AI.cpp

// AI.cpp : main project file.
#include "stdafx.h"
#include <cstdio>
//include config file
#include "../config/config.h"
using namespace System;
using namespace std;
config c;
int main()
{
    count << "My name is: " << c.getName;
    std::getchar();
}

config.h文件

Class config
{
    public void getName(){
        return 'Awesome'
    }
}

当我点击构建按钮时,我得到以下错误:

1>AI.cpp(7): fatal error C1083: Cannot open include file: 'configconfig.h': No such file or directory

VoidStar的解决方案:

Right click on the include and click on Open Document "config.h".
If VS can't resolve the path you'll get an error that tells you where it looked.

相关内容

最新更新