how to add directory for Visual Studio "Additional Library Directories"?

new to makefiles…

I need to point VS2015 to:
in its “Additional Library Directories” property for my addon (which uses the Intel RealSense SDK)

I’m trying to do this by adding it somewhere in

I tried:

    ADDON_LDFLAGS = -l$(RSSDK_DIR)lib\$(Platform)


    ADDON_LIBS += $(RSSDK_DIR)lib\$(Platform)

neither seems to work (doesn’t show up in the property when I check in VS)

Here’s a screen shot:

(note that the Additional Include Directories portion of that image is working using ADDON_INCLUDES += $(RSSDK_DIR)include)

i think there was a problem with reading environment variables in the project generator that comes with 0.9.x can you try if the one in the nightly builds works for this? you can just copy the new PG to your 0.9.x download and it’ll work for that version

Just tested with the nightly, and works perfectly using

    ADDON_LIBS += $(RSSDK_DIR)lib\$(Platform)


Actually, I spoke too soon.

The PG from the nightly is reading vs: ADDON_LIBS into Additional Library Directories in VS2015, but it’s missing the $(Platform) part.

    ADDON_LIBS += $(RSSDK_DIR)lib\$(Platform)

gives me:

C:\Program Files (x86)\Intel\RSSDK\lib

in Additional Library Directories.

I want that to be

C:\Program Files (x86)\Intel\RSSDK\lib\$(Platform)

Two notes: $(RSSDK_DIR) is an environmental variable created by the Intel RealSense SDK installer, whereas $(Platform) is a Visual Studio macro that should translate to Win32 or x64 depending on build platform.

I figured it’s looking for an environmental variable for $(Platform) and can’t find it, so it drops it.
But I tried escaping the $ using $$(Platform) - no luck.

The behavior is a bit strange in general though… when I try:


so removing the \$(Platform) part, I get:

C:\Program Files (x86)\Intel\RSSDK

So it is missing the lib folder at the end…

Strange, because


works perfectly and gives me

C:\Program Files (x86)\Intel\RSSDK\include

in Additional Include Directories.

Any thoughts?

mmh, yes we could add $$ to add variables that won’t be translated by the PG, can you open an issue in github? not sure why it would not add lib when not adding the second variable at the end though, i’ll take a look when i have a moment. if you can add it to the same issue?

Ah, it would be lovely to have the $$ escape - will open that issue in github.

But in the meantime I actually solved my specific problem:

I realized PG is parsing the lib path into folder\filename.

Everything after the last \ was ending up in the Linker > Additional Dependencies property in VS, which makes sense (just not for my case). That property is a little hidden in VS so I missed it.

To avoid the parsing, I can just write the path with a trailing slash.

ADDON_LIBS += $(RSSDK_DIR)lib\$(Platform)\

and in Linker > Additional Library Directories, I end up with

C:\Program Files (x86)\Intel\RSSDK\lib\$(Platform)

Which is correct, with the $(Platform) kept as is.

But this only works for me because there are 2 environmental variables in my lib path.

I spent some time looking through the ofAddon.cpp code in PG and realized that the reg ex match for the $(env_var) sequence only looks for the first instance in the string (see line 180).

So it’s finding $(RSSDK_DIR) and then skipping $(Platform). Probably pretty rare to have two environmental variables, so maybe no need to address that issue.

ah, ok yeah ADDON_LIBS refers to library files not to directories that’s why the PG is cutting the path, perhaps it should be smarter and not cut it unless the final part has an extension or is a file in the file system.

The reason I have a directory there is because I’m adding the library file with a MSVC compiler directive based on the build configuration:

#ifdef _DEBUG
#pragma comment(lib, "libpxcmd_d.lib")
#pragma comment(lib, "libpxcmd.lib")

Would be nice to avoid that though.
Any way to specify debug vs release in

Sorry, trying to figure all this out as I go

no worries there’s not much documentation for this and i keep adding new features as needed. i’ve tried in the past to add debug and release configs to the config file (the filesystem parser already supports it) but never got to add it.

also probably an ADDONS_LIBRARY_PATHS would be useful. with gcc/clang you can just use ADDON_LDFLAGS=-L SomePath to add a library path but i’m not sure you can do that with vs and it would be easier with a specific flag anyway. can you add that to your issue?

I’m in a similar situation want to distinguish debug lib and release lib in vs since vs is sensitive to debug/release configuration.

I tried ADDON_LDFLAGS=-L SomePath, but it seems not working.

Tested on Windows 10, vs 2017, oF 0.10.1


Hey, oddly enough, I was just working on updating libs on a fork of the ofxLibwebsockets addon –
and using separate Debug and Release folders is working for me in VS2017 + oF 0.10.1 –

the folder structure is like:

Project Generator seems to be able to parse that structure correctly for me without any tweaks. My VS project has the right library path for each build config.

Specifically, the library search path changes in VS2017 under project Properties > Linker > General > Additional Library Directories when I switch build between Debug and Release.

1 Like

Wow nice catch!
I was using C:Program File/someLib/blurblur
Instead of copying all librarie files into addon local directory(lib, include).

I will try your idea. Thanks!

yes that works we use it for ofxOpenCv, the addons config file is still not able to express different configs for release and debug but the PG and the visual studio plugin will parse it from the file system properly

1 Like