0

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

目录看起来像这样

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

人工智能.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: 'config\config.h': No such file or directory
4

1 回答 1

2

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.
于 2012-08-27T12:19:00.197 回答