Skip to content

Commit c3fed03

Browse files
metyatechclaude
andcommitted
fix: add HasFeatureFix.h to resolve __has_feature on MSVC
MSVC (VS 2022) does not define __has_feature, which is a Clang extension. Assimp and other headers that use __has_feature(x) fail to compile under MSVC without this guard. - Add Source/RuntimeAssetImport/Public/HasFeatureFix.h with an #ifndef __has_feature / #define __has_feature(x) 0 guard. - Include HasFeatureFix.h in AssetLoader.cpp, AssetConstructor.cpp, and AssetConstructorHelpers.cpp immediately after the matching header and before any engine or assimp headers, satisfying both UHT's include-order requirement and the need to define __has_feature before assimp pulls it. The header is placed in Public/ so it can be used via forced-include compiler flags (/FI) if needed in future, without requiring a namespace- qualified path from Private code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c91768e commit c3fed03

4 files changed

Lines changed: 11 additions & 3 deletions

File tree

Source/RuntimeAssetImport/Private/AssetConstructor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "AssetConstructor.h"
44

5-
#include "HasFeatureDef.h"
5+
#include "HasFeatureFix.h"
66
#include "AssetConstructorHelpers.h"
77
#include "AssetLoader.h"
88
#include "CreateMeshFromMeshDataOnProceduralMeshComponentLatentAction.h"

Source/RuntimeAssetImport/Private/AssetConstructorHelpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "AssetConstructorHelpers.h"
44

5-
#include "HasFeatureDef.h"
5+
#include "HasFeatureFix.h"
66
#include "ImageUtils.h"
77
#include "LogAssetConstructor.h"
88
#include "Materials/MaterialInstanceDynamic.h"

Source/RuntimeAssetImport/Private/AssetLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "AssetLoader.h"
44

5-
#include "HasFeatureDef.h"
5+
#include "HasFeatureFix.h"
66
#include "HAL/Platform.h"
77
#include "ImageUtils.h"
88
#include "LogAssetLoader.h"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#pragma once
2+
3+
// MSVC does not define __has_feature (it is a Clang extension).
4+
// Define it as a no-op macro so headers that use it (e.g. assimp) compile
5+
// without error under MSVC / Unreal Build Tool.
6+
#ifndef __has_feature
7+
#define __has_feature(x) 0
8+
#endif

0 commit comments

Comments
 (0)