I am getting the following link error when building a project in VS2015:
LNK2001 unresolved external symbol __imp__PathCombineW@12
The function PathCombineW is from shlwapi.h which I have included in my headers. The part that I find so confusing is that Intellisense resolves this function just fine, I can "peek definition" on the function and it takes me right to the declaration within shlwapi.h.
I have the same exact problem if I attempt to use any functions from pathcch.h. I had originally used this API because it seemed like that is the newer, preferred path manipulation API. However, I get the same exact LNK2001 with either API.
I can't figure out if it has to do with other headers I have included. They are listed below:
// daqServiceTray.cpp
#include "stdafx.h"
#include "daqServiceTray.h"
#include <Shlwapi.h>
#include <Shellapi.h>
#include <Strsafe.h>
//stdafx.h
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN
#ifndef _UNICODE
#define _UNICODE
#endif
#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
//targetver.h
#pragma once
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
#include <SDKDDKVer.h>
//dayServiceTray.h
#pragma once
#include "resource.h"
Resource.h is the header for my UI resource file. I am building these into a win32 GUI application. I am developing on Windows 7.
Reading through the error help I get the feeling like I am causing some conflict by using code from two different platform versions but I am having a lot of trouble figuring out what that conflict might be. The application was building and running OK before I attempted to do some path manipulation and added either pathcch.h or shlwapi.h.
Why can intellisense find the function by the linker yells at me for an unresolved external? Can it not find the library for the function definition? Is the order of my includes an issue?
My core question is twofold:
How can intellisense find the function but the linker cannot?
If the issue is that the definition of the function cannot be found, how can I learn which libraries need to be included for writing applications for my target platform (windows 7)? I have been having much trouble getting at this information on MSDN. Is there some kind of high level tutorial or page that explains the nuances of the build specifications for different platforms?