I am using Visual Studio 2008 C++ project (Visa 32 bit).
I have the following #include directive in my source code.
#include <example/header.h>
In my include path I specify the parent directory of ‘example’, i.e.
C:/.../include
where the full path to the header looks like
C:/.../include/example/header.h
However, ‘example’ is a symbolic link (A ‘.lnk’ created via file explorer ‘new shortcut’). I get the following error
c:…\foo.cpp(37) : fatal error C1083: Cannot open include file: ‘example/header.h’: No such file or directory
If I replace the symbolic link with the actual directory, the project will compile correctly. For practical reasons I need it to be a symbolic link. Is there anyway to make the Visual Studio pre-processor follow the link?
Are you sure you’re not creating a shortcut? Shortcuts work on a higher level than symbolic links and mean nothing to applications.
Conversely, symbolic links (if properly created) should work fine with any application that reads/writes to files/folders.
For more details, you may wish to consider reading this article about symbolic links, which explains how you can create a symbolic link using
mklink.Here’s a helpful snippet from a comment on that article by “Bernard Kerckenaere”:
What you want to create is a symbolic link which you can do with the
/Dparameter using mlink.