stergosz
stergosz

Reputation: 5860

include header file from a new folder "cannot open include file - no such file or directory"

I am using Microsoft Visual C++ 2010 for a simple console app but i am having trouble including a header file which i want to make as a config file

directory looks like this

-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 file

Class config
{

    public void getName(){
        return 'Awesome'
    }

}

When i click the Build button i get the following error:

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

Upvotes: 0

Views: 3995

Answers (1)

stergosz
stergosz

Reputation: 5860

Solution from 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.

Upvotes: 2

Related Questions