Summary: Undeclared identifier SetDefaultDllDirectories
from atlcore.h
is reported when compiling the Release version, but it is OK when compiling Debug. Further investigation shows that the _USING_V110_SDK71_
plays the role. It should be inherited from the project defaults (see picture below), but it is not for the combination: Release MinDependency, and v140_xp.
Details: I am migrating the C++ native, ATL application from Visual C++ 2005 to Visual C++ 2015. The goal is to keep the Windows XP running version as long as possible. Therefore, the v140_xp Platform Toolset was set for the project. It works fine for the Debug version. However, it causes compilation error for Release MinDepency version. When using v140 (without _xp), it compiles fine.
This is a branch of the application that needs to be migrated. I have already successfully migrated other branches (earlier) to VC++ 2008, 2010, 2012, and 2013. (Or I forgot to do something, or the situation is different now.)
I have seen that error also mentioned elsewhere; however, the reasons may be different. The full error line is:
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atlcore.h(644):
error C2065: 'SetDefaultDllDirectories':undeclared identifier
The problematic lines are used for the case when
#ifndef _USING_V110_SDK71_
So, apparently that symbol was not defined. I am using Visual Studio 2015 Professional, version 14.0.23107.0 D14REL, and Windows 8.1.
When checking the project settings, the _USING_V110_SDK71_
symbol should be defined -- inherited from project defaults.
Update: The error message and the lines around in the Output window:
1>------ Build started: Project: Market, Configuration: Release MinDependency Win32 ------
1> SplashScreen.cpp
1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\sal_supp.h(57): warning C4005: '__useHeader': macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\sal.h(2886): note: see previous definition of '__useHeader'
1>c:\program files (x86)\microsoft sdks\windows\v7.1a\include\specstrings_supp.h(77): warning C4005: '__on_failure': macro redefinition
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\sal.h(2896): note: see previous definition of '__on_failure'
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atlcore.h(644): error C2039: 'SetDefaultDllDirectories': is not a member of '`global namespace''
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atlcore.h(644): error C2065: 'SetDefaultDllDirectories': undeclared identifier
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\atlcore.h(646): error C2065: 'LOAD_LIBRARY_SEARCH_SYSTEM32': undeclared identifier
1>c:\program files (x86)\microsoft visual studio 14.0\vc\wtl90\include\atlgdi.h(470): warning C4838: conversion from 'int' to 'UINT' requires a narrowing conversion
1>c:\program files (x86)\microsoft visual studio 14.0\vc\wtl90\include\atlgdi.h(477): warning C4838: conversion from 'int' to 'UINT' requires a narrowing conversion
1>c:\program files (x86)\microsoft visual studio 14.0\vc\wtl90\include\atlgdi.h(484): warning C4838: conversion from 'int' to 'UINT' requires a narrowing conversion
1>c:\program files (x86)\microsoft visual studio 14.0\vc\wtl90\include\atlgdi.h(491): warning C4838: conversion from 'int' to 'UINT' requires a narrowing conversion
1>c:\program files (x86)\microsoft visual studio 14.0\vc\wtl90\include\atlgdi.h(3683): warning C4838: conversion from 'LONG' to 'DWORD' requires a narrowing conversion
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Could you shed some light on that? Thanks
If you converted the project files from a prior version of Visual Studio, it's possible that some build settings (including the preprocessor macro definitions) were emitted into each individual file's configuration settings. To check for this, right-click a source file and hit Properties, then navigate to the preprocessor tab. If you see bolded text in the Preprocessor Definitions field, then you'll know that this was your culprit. To fix it, you'll need to have each file inherit from the project settings, which can be tedious; I find it easiest to load up the vcxproj in a text editor and strip away the offending definitions.