swimy96800
swimy96800

Reputation: 1

IntelliSense: Identifier "XMFLOAT4" is undefined

    #ifndef RENDERER_H
    #define RENDERER_H

    #pragma once

    #include "Font.h"
    #include "Color.h"

    #undef CreateFont

struct Vertex_t {
    XMFLOAT4 xyzrhw;
    D3DCOLOR color;

    enum {
        FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE
    };
};

I get this error when i try to compile:

IntelliSense: identifier "XMFLOAT4" is undefined.

How do I fix this?

Upvotes: 0

Views: 2310

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41067

It's not clear from your code where you including <DirectXMath.h>, so I assume that's somewhere in Font.h or Color.h.

DirectXMath uses the C++ namespace DirectX so you should use:

struct Vertex_t {
    DirectX::XMFLOAT4 xyzrhw;
    D3DCOLOR color;

    enum {
        FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE
    };
};

C++ coding recommendations is to avoid putting using namespace statements in a header, only keeping them local to a .cpp file.

Upvotes: 8

Related Questions