Visual C

Programming, for all ages and all languages.
Post Reply
User avatar
mark3094
Member
Member
Posts: 164
Joined: Mon Feb 14, 2011 10:32 pm
Location: Australia
Contact:

Visual C

Post 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
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Visual C

Post 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").
Every good solution is obvious once you've found it.
Post Reply