Sign in to follow this  
Nick C.

hundreds of errors and warnings in xnamath.h

Recommended Posts

Nick C.    225
Hello everyone.
I'm getting hundreds of errors (251 to be precise) in the file xnamath.h. I'm not going to show them all, because that wouldn't make sense. The file is fine, and I can use it perfectly in other projects. It's hard to find the cause of a problem if visual studio shows errors which are not wrong. I got this problem when creating the following class (pretty simple, so I don't see how this would cause any problems). Thanks in advance. (btw, I'm pretty sure this belongs to general programming. If not, sorry about that [img]http://public.gamedev.net//public/style_emoticons/default/unsure.png[/img] )


ModelInstance.cpp:

[source lang="cpp"]#include "ModelInstance.h"


ModelInstance::ModelInstance(XMFLOAT3 scale, XMFLOAT3 rot, XMFLOAT3 offset) :
Scale(scale), Rot(rot), Offset(offset), Scale2(XMFLOAT3(1.0f, 1.0f, 1.0f)), Rot2(XMFLOAT3(0, 0, 0)), Offset2(XMFLOAT3(0, 0, 0))
{
}


ModelInstance::~ModelInstance()
{
}

void Modelinstance::Update(float dt, bool walk, XMFLOAT3 scale, XMFLOAT3 rot, XMFLOAT3 offset)
{
Scale2 = scale; Rot2 = rot; Offset2 = offset;
}
XMFLOAT4X4 Modelinstance::World()
{
XMFLOAT4X4 worldTransform;
XMStoreFloat4x4(&worldTransform,
XMMatrixScaling(Scale.x, Scale.y, Scale.z) *
(XMMatrixRotationX(Rot.x) * XMMatrixRotationY(Rot.y) * XMMatrixRotationZ(Rot.z)) *
XMMatrixTranslation(Offset.x, Offset.y, Offset.z) *
XMMatrixScaling(Scale2.x, Scale2.y, Scale2.z) *
(XMMatrixRotationX(Rot2.x) * XMMatrixRotationY(Rot2.y) * XMMatrixRotationZ(Rot2.z)) *
XMMatrixTranslation(Offset2.x, Offset2.y, Offset2.z));
return worldTransform;
}
[/source]


ModelInstance.h:

[source lang="cpp"]#ifndef MODELINSTANCE_H
#define MODELINSTANCE_H
#include <xnamath.h>

struct ModelInstance
{
public:
ModelInstance(XMFLOAT3 scale, XMFLOAT3 rot, XMFLOAT3 offset);
virtual ~ModelInstance();

virtual void Update(float dt, bool walk, XMFLOAT3 scale, XMFLOAT3 rot, XMFLOAT3 offset);
XMFLOAT4X4 World();

protected:
XMFLOAT3 Scale, Scale2;
XMFLOAT3 Rot, Rot2;
XMFLOAT3 Offset, Offset2;
};
#endif
[/source]

Share this post


Link to post
Share on other sites
Steve_Segreto    2080
[quote name='Nick C.' timestamp='1354231079' post='5005490']
I'm getting hundreds of errors (251 to be precise) in the file xnamath.h. I'm not going to show them all, because that wouldn't make sense.
[/quote]

Could you show one of the errors? How about the first one in the list of errors, that usually makes sense.

Share this post


Link to post
Share on other sites
Nick C.    225
"Error 1 error C2146: syntax error : missing ';' before identifier 'XMConvertToRadians' c:\program files (x86)\microsoft directx sdk (june 2010)\include\xnamath.h 159"

and code in xnamath.h:

//...code

#define XM_CRMASK_CR6BOUNDS XM_CRMASK_CR6FALSE
#define XM_CACHE_LINE_SIZE 64
/****************************************************************************
*
* Macros
*
****************************************************************************/
// Unit conversion
XMFINLINE FLOAT XMConvertToRadians(FLOAT fDegrees) { return fDegrees * (XM_PI / 180.0f); }

//...code

The weird thing is, I don't have any problems using xnamath in other classes. I only get these errors when including it in this class (at "#include <xnamath.h>"). My project worked perfectly before the creation of this class.

Share this post


Link to post
Share on other sites
AdeptStrain    406
[quote name='Nick C.' timestamp='1354300650' post='5005771']
Solved! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
I had to #include <d3dx11.h> first.
1 rep for Erik! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
[/quote]

You don't actually need <d3dx11.h>, just <windows.h> - as Eric mentioned above. XNAMath isn't DX11 specific.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this