Header Directories in VS2010
Let's say I have a solution/project called myTest, which just has a myTest.cpp
fi开发者_如何学Pythonle. In some completely separate folder (a Subversion folder on my desktop, for example), I have a myTest.h
file.
In Xcode, I can drag myTest.h
into the "Groups and Files" pane and I will be able to use myTest.h
by putting #include "myTest.h
in myTest.cpp
.
Is there any similar functionality for Visual Studio 2010? Dragging the file into the "Solution Explorer" pane does not work. I can set the "Include Directories" property, but then I have to use #include <myTest.h>
rather than #include "myTest.h"
. This will cause portability problems later.
you can add additional include directories in the C/C++ page of your project-properties.
then you can use #include "..."
.
The difference between ""
and <>
is that files included with ""
will be found in the same directory as the source file, or in the system include path. Files included with <>
are found only in the system include path.
Given that, do you have a file in your source directory that is the same name as the file you're trying to include?
精彩评论