# link custom library path to nmake

• ### Question

• I am building an already existing program modified to use my custom library.

I have to do that by command line using nmake but it gives me unresolved symbol error.

So, how can I specify my custom library folder outside visual studio?

Wednesday, April 24, 2013 9:57 AM

### All replies

• I am building an already existing program modified to use my custom library.

I have to do that by command line using nmake but it gives me unresolved symbol error.

So, how can I specify my custom library folder outside visual studio?

You can add it in Additional library Directories.

Project->Properties->Configuration Properties->Linker->General->Additional library Directories : <location of library>"

Thanks, Renjith V R

Wednesday, April 24, 2013 11:33 AM
• Problem is that, as I wrote,  I have to do this through command line.
Wednesday, April 24, 2013 11:52 AM
• Problem is that, as I wrote,  I have to do this through command line.
cl -I "path\to\file" test.cpp /link /LIBPATH:"C:\path\to\customlib\lib

Thanks, Renjith V R

Thursday, April 25, 2013 4:21 AM
• Set libraries search path first:

LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/res)  And then just do TARGET_LINK_LIBRARIES(GLBall mylib)  arrowdodger's answer is correct and preferred on many occasions. I would simply like to add an alternative to his answer: You could add an "imported" library target, instead of a link-directory. Something like: # Your-external "mylib" add_library( mylib SHARED IMPORTED ) # You can define two import-locations: one for debug and one for release. set_target_properties( mylib PROPERTIES IMPORTED_LOCATION (${CMAKE_BINARY_DIR}/res/ )


• Proposed as answer by Monday, May 6, 2013 9:00 AM
• Marked as answer by Tuesday, May 7, 2013 8:47 AM
• Unmarked as answer by Tuesday, May 7, 2013 8:47 AM
• Unproposed as answer by Tuesday, May 7, 2013 8:49 AM
Friday, April 26, 2013 9:31 AM