Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.3k views
in Technique[技术] by (71.8m points)

c++ - 'Additional include directories' in visual studio 2010 doesn't work

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:codeLibraryProject1
c:codeLibraryProject2

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)

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:codeLibraryProject2MyTestDlg.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:codeLibraryProject1 1.0.0
c:codeLibraryProject2 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 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.

Addon:

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:WindowsMicrosoft.NETFrameworkv4.0.30319Microsoft.Common.Targets(1200,9): warning : The referenced project '..GraphGraph.vcxproj' does not exist.
1>InitializeBuildStatus:
1>  Touching "DebugViewerLib.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>  OpenViewerDlg.cpp
1>c:codelibrariesviewerlibviewerdlg.cpp(6): fatal error C1083: Cannot open include file: 'GraphCtrl.h': No such file or directory
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I realize it's an old topic, but thought I'd add my solution in case future searchers have the same specific scenario.

In my case the additional include directory was defined as a User Macro in a Property Page (accessed via View, Property Manager, then right click on the project, Properties). But although the value was updated there, the property page was not actually saved (even though the C++, Command Line property showed the correct path (!)). Had to check out the .props file from source control and save it, then rebuild - finally the include files in that directory are found.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...