How to find the systemroot (in C#, C++ and Java)


Naturally, a lot of my search engine traffic comes here from searching for terms like “system root in &ltinsert 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.

Read the rest of this entry »

C# Image.Save Always Outputs PNG Format


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 »

Visual Studio C++ Edit Include Paths/Linker Settings


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:

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:

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.

Latest Posts



Post Calendar

March 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031