473,737 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\Di st\Include
...\ProjectB\Di st\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 2708
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\Dis t\Include
..\ProjectB\Dis t\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
"..\BasicOuterL ayer\Dist\Inclu de" it gets it from "..\Share\Inclu de".

Interestingly enough if I delete "cppfile1.h " from "..\Share\Inclu de" the
project compiles with the correct version from
"..\BasicOuterL ayer\Dist\Inclu de". 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\Inclu de". 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="Windo ws-1252"?>
<VisualStudioPr oject
ProjectType="Vi sual C++"
Version="7.10"
Name="XXXProduc t"
ProjectGUID="{3 DF4856C-4223-4DD3-A93B-640C4525E02B}"
RootNamespace=" XXXProduct"
SccProjectName= ""
SccAuxPath=""
SccLocalPath=""
SccProvider="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations >
<Configuratio n
Name="Debug|Win 32"
OutputDirectory ="..\Dist\Ex e"
IntermediateDir ectory=".\Debug "
ConfigurationTy pe="1"
UseOfMFC="0"
ATLMinimizesCRu nTimeLibraryUsa ge="FALSE"
CharacterSet="1 ">
<Tool
Name="VCCLCompi lerTool"
Optimization="0 "

AdditionalInclu deDirectories=" ..\Dist\Include ;..\Product_2_S IL\Dist\Include ;
...\BasicInnerL ayer\Dist\Inclu de;..\BasicOute rLayer\Dist\Inc lude;..\AlarmsE ve
nts\Dist\Includ e;..\ConfigProx yStub\Dist\Incl ude;..\ComfigLi brary\Dist\Incl u
de;..\OuterLaye rConfigProxyStu b\Dist\Include; ..\HardwareKeyL icensing\Dist\I n
clude;..\Softwa reKeyLicensing\ Dist\Include;.. \LogLibrary\Dis t\Include;..\Da t
aStormProduct_A PI\Dist\Include ;..\DataStormPr oduct_Core\Dist \Include;..\Dat a
StormProduct_Cl ient\Dist\Inclu de;..\M3_Interf aces_M3Common\D ist\Include;..\ S
hare\Src;..\Sha re\Include"

PreprocessorDef initions="_DEBU G;WIN32;_WINDOW S;UNICODE;_WIN3 2_WINNT=0x0400; _
CONSOLE;_USE_DE BUGLIB_FILE"
RuntimeLibrary= "1"
RuntimeTypeInfo ="TRUE"
UsePrecompiledH eader="2"
PrecompiledHead erFile=".\Debug/XXXProduct.pch"
AssemblerListin gLocation=".\De bug/"
ObjectFile=".\D ebug/"
ProgramDataBase FileName=".\Deb ug/"
BrowseInformati on="1"
BrowseInformati onFile=".\Debug/"
WarningLevel="3 "
SuppressStartup Banner="TRUE"
DebugInformatio nFormat="3"/>
<Tool
Name="VCCustomB uildTool"/>
<Tool
Name="VCLinkerT ool"
AdditionalOptio ns="/fixed:no"
AdditionalDepen dencies="versio n.lib Ws2_32.lib Netapi32.lib
MatDebug_dmtw.l ib PXPIL_d.lib PXPIL_AE_mtd.li b PXPOLE_XXX_d.li b
PXPIL_Product_d .lib StaticLicense_d .lib dscore_d.lib dsapi_d.lib
DSClientLib_d.l ib keylib_d.lib XMLConfigWrappe r_d.lib M3Framework_d.l ib
M3Common_d.lib"
OutputFile="..\ Dist\Exe\XXXPro duct_d.exe"
LinkIncremental ="1"
SuppressStartup Banner="TRUE"

AdditionalLibra ryDirectories=" ..\Product_2_SI L\Dist\Lib;..\B asicInnerLayer\ D
ist\Lib;..\Basi cOuterLayer\Dis t\Lib;..\Alarms Events\Dist\Lib ;..\ComfigLibra r
y\Dist\Lib;..\C onfigProxyStub\ Dist\Lib;..\Dat aStormProduct_A PI\Dist\Lib;..\ D
ataStormProduct _Core\Dist\Lib; ..\DataStormPro duct_Client\Dis t\Lib;..\Hardwa r
eKeyLicensing\D ist\Lib;..\LogL ibrary\Dist\Lib ;..\M3_PeerFram ework\Dist\Lib; .
..\XXX_AE_1.0\D ist\Lib;..\XXX_ DA_2.0\Dist\Lib ;..\XXX_HDA_1.0 \Dist\Lib;..\Ou te
rLayerConfigPro xyStub\Dist\Lib ;..\SoftwareKey Licensing\Dist\ Lib;..\Share\Li b
"
GenerateDebugIn formation="TRUE "
ProgramDatabase File="$(OutDir)/XXXProduct_d.pd b"
GenerateMapFile ="TRUE"
MapFileName=".\ Debug/XXXProduct_d.ma p"
SubSystem="2"
TargetMachine=" 1"/>
<Tool
Name="VCMIDLToo l"
PreprocessorDef initions="_DEBU G"
MkTypLibCompati ble="TRUE"
SuppressStartup Banner="TRUE"
TargetEnvironme nt="1"
TypeLibraryName =".\./XXXProduct.tlb"
HeaderFileName= ""/>
<Tool
Name="VCPostBui ldEventTool"
CommandLine="In cbuild XXXProduct.ver /rc=XXXProduct.r c"/>
<Tool
Name="VCPreBuil dEventTool"/>
<Tool
Name="VCPreLink EventTool"/>
<Tool
Name="VCResourc eCompilerTool"
PreprocessorDef initions="_DEBU G"
Culture="1033"

AdditionalInclu deDirectories=" ..\Log\Dist\Inc lude;..\BasicIn nerLayer\Dist\I n
clude;..\XXXOut erLayer\Dist\In clude;&quot;..\ XXXOuterLayer\E tc\Comfig
Library\Dist\In clude&quot;;&qu ot;..\XXXOuterL ayer\Etc\Outer Layer Config
Proxy
Stub\Dist\Inclu de&quot;;..\Pro duct_SIL\Dist\I nclude;..\Share \Include;&quot; $
(MTKCOMMON)\Win NT\Include&quot ;"
ResourceOutputF ileName="Debug/OxModicon.res"/>
<Tool
Name="VCWebServ iceProxyGenerat orTool"/>
<Tool
Name="VCXMLData GeneratorTool"/>
<Tool
Name="VCWebDepl oymentTool"/>
<Tool
Name="VCManaged WrapperGenerato rTool"/>
<Tool
Name="VCAuxilia ryManagedWrappe rGeneratorTool"/>
</Configuration>
<References>
</References>
<Files>
<File
RelativePath="G uids.h">
</File>
<File
RelativePath="i con1.ico">
</File>
<File
RelativePath="m ain.cpp">
<FileConfigurat ion
Name="Debug|Win 32">
<Tool
Name="VCCLCompi lerTool"
Optimization="0 "
PreprocessorDef initions=""
BrowseInformati on="1"/>
</FileConfigurati on>
</File>
<File
RelativePath="M ain.h">
</File>
<File
RelativePath="X XXProduct.rc">
<FileConfigurat ion
Name="Debug|Win 32">
<Tool
Name="VCResourc eCompilerTool"
PreprocessorDef initions="_DEBU G;$(NoInherit)"/>
</FileConfigurati on>
</File>
<File
RelativePath="X XXProduct.ver">
</File>
<File
RelativePath="X XXProduct_versi on.c">
<FileConfigurat ion
Name="Debug|Win 32">
<Tool
Name="VCCLCompi lerTool"
Optimization="0 "
PreprocessorDef initions=""
BrowseInformati on="1"/>
</FileConfigurati on>
</File>
<File
RelativePath=". \resource.h">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioPro ject>

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

- Arpi

"Carl Daniel [VC++ MVP]" <cp************ *************** **@mvps.org.nos pam>
wrote in message news:ON******** *****@TK2MSFTNG P11.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\Dis t\Include
..\ProjectB\Dis t\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\Inclu de", 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 "..\BasicOuterL ayer\Dist\Inclu de" it gets it from
"..\Share\Inclu de".

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\Inclu de".


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
5120
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 relative NOT to the immediate script that is including it, but is relative to the top-level calling script. In practice, this means that you have to constantly worry and adjust paths in includes, based on the startup scripts that call these...
2
2939
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 driven. The regex would include if/then/else type logic, and would like my script to conditionally execute the logic. -- http://www.dbForumz.com/ This article was posted by author's request
7
3549
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 way to do this in 3 steps: 1. Add in main_file.cpp
4
15053
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 standard include directories for files included as <file> but not for those included as "file". It's clear to me then that headers for the standard libraries (eg, iostream) should be included using the '#include <iostream>' form while header...
18
2633
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> Assume that this library will be used by other groups. I think the answer
0
1195
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 file: //////////////////////////////////////////////////////////////////////////// / // // Generated from the TEXTINCLUDE 2 resource. // #include "buildoptions.h"
2
3084
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 SDK. now just after i added the above line i got this messages: D:\Program\Microsoft DirectX SDK (April 2007)\Include\strsafe.h(221) : error C3641: 'StringCchCopyA' : invalid calling convention '__stdcall
12
2580
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
9467
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9257
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4567
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3278
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.