VS .NET, violates listing order in "Additional Include Directories"

A

Arpi Jakab

I have a main project that depends on projects A and B. The main project's
additional include directories list is:

...\ProjectA\Dist\Include
...\ProjectB\Dist\Include

Each of the include directories contain a file named "cppfile1.h".

In my main project I #include "cppfile1.h". I rely on the order of paths in
additional include directories list to get file cppfile1.h from ProjectA and
not from ProjectB. Although this is not the case. The cppfile1.h from
ProjectB is compiled into the main project. I do not use precompiled headers
in the main project.

The source of the problem seem to be that the main project has a #include
for a file called "cppfile2.h" that is only located in ProjectB. Since this
file is #included into the main project before cppfile1.h, VS .NET seems to
grab all files from the ProjectB directory including the wrong version of
cppfile1.h. The ProjectB version of the cppfile1.h is used for all future
#includes, despite the order of directories in the "Additional Include
Directories" list.

I do not control code for projects A and B and hence cannot rename
cppfile1.h. Any help would be greatly appreciated.

- Arpi
 
C

Carl Daniel [VC++ MVP]

Arpi said:
I have a main project that depends on projects A and B. The main
project's additional include directories list is:

..\ProjectA\Dist\Include
..\ProjectB\Dist\Include

Each of the include directories contain a file named "cppfile1.h".

In my main project I #include "cppfile1.h". I rely on the order of
paths in additional include directories list to get file cppfile1.h
from ProjectA and not from ProjectB. Although this is not the case.
The cppfile1.h from ProjectB is compiled into the main project. I do
not use precompiled headers in the main project.

The source of the problem seem to be that the main project has a
#include for a file called "cppfile2.h" that is only located in
ProjectB. Since this file is #included into the main project before
cppfile1.h, VS .NET seems to grab all files from the ProjectB
directory including the wrong version of cppfile1.h. The ProjectB
version of the cppfile1.h is used for all future #includes, despite
the order of directories in the "Additional Include Directories" list.

I do not control code for projects A and B and hence cannot rename
cppfile1.h. Any help would be greatly appreciated.

Are you certain that the .cpp file in question doesn't have a file-specific
include path set for it? I'd recommend opening the .vcproj file in a text
editor and finding the .cpp file that's doing the #including to be sure.

Some projects converted from VC6 will erroneously have project settings
copied to file settings during the conversion. Changing the project setting
then has no effect on the file since the per-file settings take precedence.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top