首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >包含来自新文件夹的头文件“无法打开包含文件-没有这样的文件或目录”

包含来自新文件夹的头文件“无法打开包含文件-没有这样的文件或目录”
EN

Stack Overflow用户
提问于 2012-08-27 12:09:33
回答 1查看 3.9K关注 0票数 0

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

目录看起来像这个

代码语言:javascript
复制
-AI
  --config
    --config.h
  --Header Files
  --Resource Files
  --Source Files

AI.cpp

代码语言:javascript
复制
// 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文件

代码语言:javascript
复制
Class config
{

    public void getName(){
        return 'Awesome'
    }

}

当我单击Build按钮时,会得到以下错误:

代码语言:javascript
复制
1>AI.cpp(7): fatal error C1083: Cannot open include file: 'config\config.h': No such file or directory
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-27 12:19:00

VoidStar的解决方案

代码语言:javascript
复制
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.
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12141718

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档