0

This is my first time working with header files, and I have a source code and I'm trying to include my header file. The name of my header file is called ccc_time.h and i have #include "ccc_time.h" written in the beginning of my source file which is just called source.cpp however visual studio says no such header ccc_time.h file or directory exists.

The header file I did not write, it was assigned for my homework and i don't think I'm suppose to modify it. In the beginning of the header file, it reads

#ifndef CCC_TIME_H
#define CCC_TIME_H

I was also given another file called ccc_time.cpp and it has no problem recognizing the header file ccc_time.h but i can't seem to get my source.cpp to recognize that header file

8
  • You have to add additional include directories if it is not in the same folder as the .cpp file
    – user995502
    Commented Apr 6, 2013 at 22:50
  • then he also doesn't call "ccc_time.h" but <ccc_time.h> so probably this is in same dir
    – 4pie0
    Commented Apr 6, 2013 at 22:53
  • is the header ccc_time.h in the same directory as source.cpp?
    – user995502
    Commented Apr 6, 2013 at 22:54
  • is this file in same dir as your project?
    – 4pie0
    Commented Apr 6, 2013 at 22:54
  • 1
    copy file to your project dir and stay with #include "ccc_time.h" notation
    – 4pie0
    Commented Apr 6, 2013 at 22:55

1 Answer 1

2

if you want to add header with

 #include "ccc_time.h"

statement, then this header has to be in your project dir. So you may copy file to your project dir and stay with #include "ccc_time.h" notation. Alternatively you might add path to folder where the file is located in your project "additional includes directory" and add then header with

 #include <ccc_time.h> statement.

you may also copy header to path already included, i.e to:

ProgramFiles\MicrosoftVisualStudio11.0\VC\include

and again: add with #include <ccc_time.h> statement.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.