# UTexture::UpdateResource() overwrote by winbase.h #define

**URL:** <https://forums.unrealengine.com/t/utexture-updateresource-overwrote-by-winbase-h-define/399580>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [July 2, 2017, 9:07pm UTC](https://forums.unrealengine.com/t/utexture-updateresource-overwrote-by-winbase-h-define/399580 "2017-07-02T21:07:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f9e5c401](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f9e5c401](https://forums.unrealengine.com/u/anonymous_user_f9e5c401)\
**Post date:** [July 2, 2017, 9:07pm UTC](https://forums.unrealengine.com/t/utexture-updateresource-overwrote-by-winbase-h-define/399580/1 "2017-07-02T21:07:22Z")

</div>

I have a UTexture2D\* variable called texture. UTexture2D has a macro called “UpdateResource” that calls “UpdateResourceW()”. When I call “texture-\>UpdateResource();”, I get the error “class “UTexture2D” has no member “UpdateResourceW””.

EDIT: Going to the definition in VS takes me to WinBase.h. So it’s using some #define from WinBase, which overwrites it, then trying to call the newly named function name UpdateResourceW on the Texture2D reference?.

```
        texture = UTexture2D::CreateTransient(ImageWrapper->GetWidth(), ImageWrapper->GetHeight(), PF_B8G8R8A8);
        void* textureData = texture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
        FMemory::Memcpy(textureData, DecodedImage.GetData(), DecodedImage.Num());
        texture->PlatformData->Mips[0].BulkData.Unlock();
        texture->UpdateResource();

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8c09e5641](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8c09e5641](https://forums.unrealengine.com/u/anonymous_user_8c09e5641)\
**Post date:** [July 3, 2017, 12:15am UTC](https://forums.unrealengine.com/t/utexture-updateresource-overwrote-by-winbase-h-define/399580/2 "2017-07-03T00:15:49Z")

</div>

There’s lots of nasty things in winbase that uses the preprocessor to define a reference to either the W (wide character) or A (ASCII character) version of windows functions, based on whether you have the wide character compilation flag raised.

I’ve not come across this exact issue, but if you simply need a resolution, include winbase.h in your precompiled header file, then #undef UpdateResource.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f9e5c401](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f9e5c401](https://forums.unrealengine.com/u/anonymous_user_f9e5c401)\
**Post date:** [July 3, 2017, 6:03pm UTC](https://forums.unrealengine.com/t/utexture-updateresource-overwrote-by-winbase-h-define/399580/3 "2017-07-03T18:03:21Z")

</div>

Similar to what I did. I just #define UpdateResource UpdateResource right above the call. using #undef is probably a more standard/cleaner way, though.

---

<div class="post-metadata">

**Author:** ![CrimsonHawk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CrimsonHawk](https://forums.unrealengine.com/u/CrimsonHawk)\
**Post date:** [August 12, 2024, 6:17am UTC](https://forums.unrealengine.com/t/utexture-updateresource-overwrote-by-winbase-h-define/399580/4 "2024-08-12T06:17:35Z")

</div>

For those who run into this error later, like I did:

You need to add `#include "Windows/MinWindows.h"` anywhere before the header that causes your errors!

It works for any similar type of Windows-redefine-errors

---

<div class="post-metadata">

**Author:** ![Gabriel\_UMe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gabriel\_UMe](https://forums.unrealengine.com/u/Gabriel_UMe)\
**Post date:** [January 21, 2025, 10:38pm UTC](https://forums.unrealengine.com/t/utexture-updateresource-overwrote-by-winbase-h-define/399580/5 "2025-01-21T22:38:33Z")

</div>

Worked for me, but when compiling I get a message instructing me to use  
`#include "Windows/WindowsHWrapper.h"`  
Using that instead seems to work…

However, the compilation seems to be non-deterministic, so having solved the problem I can’t reproduce it.
