Page 1 of 1

Visual C

Posted: Thu Mar 03, 2011 4:59 am
by mark3094
Hi,

I am reasonably new to Visual C++, and I have a question about headers.
Currently my 'solution' (as VC++ calls it) contains three projects, two of which are static libraries, the other is the main project.
I have tried creating a header file under the 'Header Files' in a library project, then in main.c I have tried to include it.
VC++ comlains that it can't find the header file. I realise that I could add the path to the include path on the main project.

Is this the correct VC++ way? Should I be putting the header files in the library projects, which contain the functions I am 'extern'ing, or should I put the header files in the main project, which contains the file within which I am '#include'ing the headers?

Sorry if what I have written is confusing, or sounds a bit silly. I'm just interested in the best practice in this case.


Thanks again

Re: Visual C

Posted: Thu Mar 03, 2011 5:49 am
by Solar
You should take this to a generic (MSVC) programming forum. This kind of basic toolchain / elementary programming questions isn't really welcome here.

That being said, headers should always reside together with the implementation files they are describing, i.e. a library's headers together with that library's code / project.

MSVC does allow adding header files to a project for ease of editing only. There is no automatism to actually make those headers includable. This has to be configured in a project's properties ("Additional Include Directories").