Naturally, a lot of my search engine traffic comes here from searching for terms like “system root in <insert language here>” or “%systemroot%”. So, to live up to my domain, and you Googler’s expectations, I’ve decided to write a post about how to get the path to the system root in a few languages. If you know more, drop a comment and I’ll add it here.
I recently had to work on a project where I needed to open an image, rotate it by 90 degrees and save it again in C#. I was having some issues where it would always save the image in the PNG format regardless of what format it was loaded from. Here’s the code that I had: Read the rest of this entry »
I’m posting this info on how to set up extra include paths and edit linked files in Visual Studio for my own reference.
This was originally acquired from here on October 10, 2010.
Settings for compiler
In the project where you want to #include the header file from another project, you will need to add the path of the header file into the Additional Include Directories section in the project configuration.
To access the project configuration:
Right-click on the project, and select Properties.
Select Configuration Properties->C/C++->General.
Set the path under Additional Include Directories.
How to include
To include the header file, simply write the following in your code:
C#
1
#include "filename.h"
Note that you don’t need to specify the path here, because you include the directory in the Additional Include Directories already, so Visual Studio will know where to look for it.
If you don’t want to add every header file location in the project settings, you could just include a directory up to a point, and then #include relative to that point:
C#
1
2
3
4
5
// In project settings
// Additional Include Directories ..\..\libroot
// In code
#include "lib1/lib1.h" // path is relative to libroot
#include "lib2/lib2.h" // path is relative to libroot
Setting for linker
If using static libraries (i.e. .lib file), you will also need to add the library to the linker input, so that at linkage time the symbols can be linked against (otherwise you’ll get an unresolved symbol):
Right-click on the project, and select Properties.
Select Configuration Properties->Linker->Input
Enter the library under Additional Dependencies.
About the Author
Hey there! My name is Richard Marskell and I'm the co-founder of LBC IT Solutions, Inc.. I've been developing websites, apps and even games for over 22 years.
I previously worked at a leading Canadian market research company for 8.5 years, managing their tech team and projects—everything from project & resource management to designing client websites.
This blog is where I share some of the things I've found (or figured out) throughout my career.
Have something to say? Drop me a comment or tweet me .