Visual Studio 2010中的“其他包含目录"不起作用 [英] 'Additional include directories' in visual studio 2010 doesn't work

查看:300
本文介绍了Visual Studio 2010中的“其他包含目录"不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这上面敲了一下头,所以我认为我会发表.我有两个库项目,其中Project2在以下目录结构中使用/引用Project1.

I am banging my head on this one for a while so I figure I will post. I have two library projects where Project2 uses/references Project1 in the following directory structure.

c:\code\Library\Project1
c:\code\Library\Project2

两个都是图书馆项目.我已经在Project2的属性">配置属性">"C/C ++">常规">附加包含目录"中包含了该路径.读取..\Project1; %(AdditionalIncludeDirectories)

Both are library projects. I have included the path in Project2 at Properties>Configuration Properties>C/C++>General>'Additonal Include Directories'. It reads ..\Project1; %(AdditionalIncludeDirectories)

现在Project2中有一个文件,其中#includes project1文件夹中存在的文件.尽管已包含上述路径,但仍然会出现错误:

Now there is a file in Project2 which #includes file that is present in project1 folder. Inspite of having included the path as above it still comes up with an error:

1>c:\code\Library\Project2\MyTestDlg.cpp(6): fatal error C1083: Cannot open include file: 'GraphCtrl.h': No such file or directory

奇怪的是,如果不更改原始项目名称,类似的设置也会起作用.这些项目最初位于它们可以正常链接的文件夹中.

The weird thing is that similar setting works if I don't change the original project names. The projects are originally in folder where they link fine.

c:\code\Library\Project1 1.0.0
c:\code\Library\Project2 1.0.0

我正在做的是从项目文件夹中删除最近的版本名称(然后再次将它们重新链接在一起),但这已成为噩梦!有什么建议吗?

What I am doing is removing the last version names from the project folders (and relink them together again) but this has become a nightmare! Any suggestions?

p.s我对此进行了很多研究,似乎与目录的长度有关,但是我认为我在限制方面表现不错.以前较长的文件夹名称有效而较短的文件夹名称无效,这表明长度不是问题.

p.s I did research on this quite a bit and it seems like has to do with length of the directories but I think I am well with in limits. The fact that previously longer folder names work and short doesn't, it shows lengths are not the issue.

插件:

以下是我使用实际文件名遇到的实际错误:问题之一是,尽管我已经完全删除了它并且找不到了更多内容,但它仍然以某种方式仍引用了具有全名GraphCtrlLib 1.0.0.0的旧库.参考.我说这可能与该错误无关.

The following is the actual error I am getting with actual file names: One of the problem is that somehow it still references the old library with full name GraphCtrlLib 1.0.0.0 even though I have completely removed it and can't find any more reference of it. I this it probably is not related to this error though.

1>Build started 12/11/2012 5:16:02 PM.
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1200,9): warning : The referenced project '..\Graph\Graph.vcxproj' does not exist.
1>InitializeBuildStatus:
1>  Touching "Debug\ViewerLib.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>  OpenViewerDlg.cpp
1>c:\code\libraries\viewerlib\viewerdlg.cpp(6): fatal error C1083: Cannot open include file: 'GraphCtrl.h': No such file or directory

推荐答案

最后解决了该问题.我在记事本中打开.vcxproj文件,并将所有旧路径的引用更改为新路径并保存.那解决了这个问题.

Finally fixed the problem. I opened the .vcxproj file in notepad and changed all reference of old path to new path and saved it. That fixed the problem.

这是由于项目文件是只读文件而VC2010没有正确更新它引起的.我一直在项目属性中进行更改,通过回读它们可以告诉我它们想要的状态,但是当我关闭项目并将其加载回时,它又回到了更改之前的状态.因此,这些更改从未得到应用. VS2010并没有告诉我它无法保存或应用更改,但会接受它们,而永远不会应用它们!

It was caused by the fact that the project file was read only and VC2010 was not updating it properly. I kept making the changes in project properties and I could tell by reading back that they are as I wanted them but when I closed the project and load it back, it was back to what was before change. So the changes were never getting applied. VS2010 didn't tell me that it can't save or apply the changes but would accept them and never apply them!

这篇关于Visual Studio 2010中的“其他包含目录"不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆