473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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

Nov 17 '05 #1
3 2658
Arpi Jakab wrote:
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
Nov 17 '05 #2
The .cpp file in question does not further qualify the name of the header
file.

The .cpp file is "main.cpp", which includes "XXXProduct.ver". The .ver file
includes "cppfile1.h". Instead of getting it from include path
"..\BasicOuterLayer\Dist\Include" it gets it from "..\Share\Include".

Interestingly enough if I delete "cppfile1.h" from "..\Share\Include" the
project compiles with the correct version from
"..\BasicOuterLayer\Dist\Include". Also, once I have been able to build and
link successfully, I cannot reproduce the problem when the wrong version of
"cppfile1.h" is copied back to "..\Share\Include". Even if I do a rebuild on
the project. This issue has been reproduced in-house by other developers on
a different project.

The simplified .NET project file is:

<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="XXXProduct"
ProjectGUID="{3DF4856C-4223-4DD3-A93B-640C4525E02B}"
RootNamespace="XXXProduct"
SccProjectName=""
SccAuxPath=""
SccLocalPath=""
SccProvider="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\Dist\Exe"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"

AdditionalIncludeDirectories="..\Dist\Include;..\P roduct_2_SIL\Dist\Include;
...\BasicInnerLayer\Dist\Include;..\BasicOuterLaye r\Dist\Include;..\AlarmsEve
nts\Dist\Include;..\ConfigProxyStub\Dist\Include;. .\ComfigLibrary\Dist\Inclu
de;..\OuterLayerConfigProxyStub\Dist\Include;..\Ha rdwareKeyLicensing\Dist\In
clude;..\SoftwareKeyLicensing\Dist\Include;..\LogL ibrary\Dist\Include;..\Dat
aStormProduct_API\Dist\Include;..\DataStormProduct _Core\Dist\Include;..\Data
StormProduct_Client\Dist\Include;..\M3_Interfaces_ M3Common\Dist\Include;..\S
hare\Src;..\Share\Include"

PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;UNI CODE;_WIN32_WINNT=0x0400;_
CONSOLE;_USE_DEBUGLIB_FILE"
RuntimeLibrary="1"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/XXXProduct.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
BrowseInformationFile=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/fixed:no"
AdditionalDependencies="version.lib Ws2_32.lib Netapi32.lib
MatDebug_dmtw.lib PXPIL_d.lib PXPIL_AE_mtd.lib PXPOLE_XXX_d.lib
PXPIL_Product_d.lib StaticLicense_d.lib dscore_d.lib dsapi_d.lib
DSClientLib_d.lib keylib_d.lib XMLConfigWrapper_d.lib M3Framework_d.lib
M3Common_d.lib"
OutputFile="..\Dist\Exe\XXXProduct_d.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"

AdditionalLibraryDirectories="..\Product_2_SIL\Dis t\Lib;..\BasicInnerLayer\D
ist\Lib;..\BasicOuterLayer\Dist\Lib;..\AlarmsEvent s\Dist\Lib;..\ComfigLibrar
y\Dist\Lib;..\ConfigProxyStub\Dist\Lib;..\DataStor mProduct_API\Dist\Lib;..\D
ataStormProduct_Core\Dist\Lib;..\DataStormProduct_ Client\Dist\Lib;..\Hardwar
eKeyLicensing\Dist\Lib;..\LogLibrary\Dist\Lib;..\M 3_PeerFramework\Dist\Lib;.
..\XXX_AE_1.0\Dist\Lib;..\XXX_DA_2.0\Dist\Lib;..\X XX_HDA_1.0\Dist\Lib;..\Oute
rLayerConfigProxyStub\Dist\Lib;..\SoftwareKeyLicen sing\Dist\Lib;..\Share\Lib
"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/XXXProduct_d.pdb"
GenerateMapFile="TRUE"
MapFileName=".\Debug/XXXProduct_d.map"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="TRUE"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
TypeLibraryName=".\./XXXProduct.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="Incbuild XXXProduct.ver /rc=XXXProduct.rc"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"

AdditionalIncludeDirectories="..\Log\Dist\Include; ..\BasicInnerLayer\Dist\In
clude;..\XXXOuterLayer\Dist\Include;&quot;..\XXXOu terLayer\Etc\Comfig
Library\Dist\Include&quot;;&quot;..\XXXOuterLayer\ Etc\Outer Layer Config
Proxy
Stub\Dist\Include&quot;;..\Product_SIL\Dist\Includ e;..\Share\Include;&quot;$
(MTKCOMMON)\WinNT\Include&quot;"
ResourceOutputFileName="Debug/OxModicon.res"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<References>
</References>
<Files>
<File
RelativePath="Guids.h">
</File>
<File
RelativePath="icon1.ico">
</File>
<File
RelativePath="main.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="Main.h">
</File>
<File
RelativePath="XXXProduct.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;$(NoInherit)"/>
</FileConfiguration>
</File>
<File
RelativePath="XXXProduct.ver">
</File>
<File
RelativePath="XXXProduct_version.c">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath=".\resource.h">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Content of XXXProduct.ver:
----------------
"\n{"
/* components */
#include "cppfile1.h"
"\n}"
----------------
Any help is greatly appreciated.

- Arpi

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:ON*************@TK2MSFTNGP11.phx.gbl...
Arpi Jakab wrote:
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

Nov 17 '05 #3
Arpi Jakab wrote:
The .cpp file in question does not further qualify the name of the
header file.

The .cpp file is "main.cpp", which includes "XXXProduct.ver". The
Where is Product.ver located? If it's in "..\Share\Include", then that's
your problem. The compiler always looks for a #included file in the
directory that contains the including file first (if it's a #include "file",
not a #include <file>, in which case the directory where the including file
was found is ignored).
.ver file includes "cppfile1.h". Instead of getting it from include
path "..\BasicOuterLayer\Dist\Include" it gets it from
"..\Share\Include".

Also, once I have been able to
build and link successfully, I cannot reproduce the problem when the
wrong version of "cppfile1.h" is copied back to "..\Share\Include".


How a difference could survive a full rebuild is hard to envision.
Surviving a normal build is entirely possible, depending on usage of
precompiled headers.

-cd
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: steve | last post by:
I am quite frustrated with php’s include, as I have spent a ton of time on it already... anyone can tell me why it was designed like this (or something I don’t get)? The path in include is...
2
by: steve | last post by:
Hi, I need to do conditional script "include", but like to pull the code from db instead of a file. How do I do that? Reason: I like to implement some complex regex logic, and make it table...
7
by: mescaline | last post by:
Hi, Suppose a_file.cpp contains a function a_function() Now to include it in main_file.cpp I just do #include "a_file.cpp" and I'm all set. i recently came across this seemingly roundabout...
4
by: Exits Funnel | last post by:
Hello, I'm slightly confused about when to use parens around #included files and when to use angle brackets. I understand (I think) that the difference is that the compiler will search in its...
18
by: Tuckers | last post by:
My question is, if I have created my own library which lives in its own install directory, to refer to its header file is it better to use #include "MyLibrary.h" or #include <MyLibrary.h> ...
0
by: Bartosz Milewski | last post by:
My resource file compiles correctly, but when I try to open it in VS, I get the error, "cannot find include file". The file in question is a "constant include". This is what it looks like in the rc...
2
by: untitled | last post by:
i included the following line to VC++ after i installed the directx SDK and platform SDK. #include "DShow.h" i configured c directories for the include and lib to both directx SDX and platform...
12
by: Pablo Suarez | last post by:
When I code #include "myheader.h" then this header file is searched in the current directory. But where does the compiler search the header file when I write #include <myheader.h>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.