0

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
3
  • 2
    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. Commented Aug 27, 2012 at 12:14
  • That's what the Solution Explorer window looks like. Not what the file system looks like. Items like "Header Files" are not directories, they are "filters". Good odds that "config" is not actually a directory either. Commented Aug 27, 2012 at 12:17
  • thanks, i actually didn't have to specify any folder path... just the file name "config.h" and it worked.... other than the other errors on the functions but it seem to solve this problem for now... Commented Aug 27, 2012 at 12:18

1 Answer 1

2

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.
Sign up to request clarification or add additional context in comments.

1 Comment

I just had this problem. Accidentally unchecked inherit from project defaults in properties

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.