ATL library :warning LNK4254 and LNK4078
Asked Answered
M

1

9

I am making a project using Visual C++ 2010 under Windows 7. I need to use ATL library, in fact I installed Windows WDK (version 7600.16385.1) In particular I using the following libraries from WDK

  • setupapi.lib
  • atls.lib
  • atlsd.lib
  • atl.lib
  • atlthunk.lib

Compiling my code I have the following warnings:

atls.lib(stdafx.obj) : warning LNK4254: section 'ATL' (50000040) merged into '.rdata' (40000040) with different attributes

atls.lib(stdafx.obj) : warning LNK4078: multiple 'ATL' sections found with different attributes (40301040)

Does anyone know how to fix it? I am worried of possible memory leaks or having some problem to access my data. Thanks

Maunder answered 4/3, 2012 at 22:44 Comment(2)
Are you using Express version of Visual Studio? Any specific reason to link all the mentioned libs? atls and atlsd are release and debug verions of the same library, you are very unlikely to need both.Glidden
@RomanR. You should post that as an answer since using both atls.lib and atlsd.lib is almost certainly the cause of the errors.Oubre
H
10

I had the same warnings with Visual Studio 2010 Express Edition and the ATL taken from WDK 7.1. It seems that the atl libs were built with different options than your project takes from atlbase.h. I changed the settings in atlbase.h

#pragma section("ATL$__a", read, shared) => #pragma section("ATL$__a", read)
#pragma section("ATL$__z", read, shared) => #pragma section("ATL$__z", read)
#pragma section("ATL$__m", read, shared) => #pragma section("ATL$__m", read)

and the warnings were gone.

Helsinki answered 9/1, 2013 at 19:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.