Im using directxtutorial.com tutorial.. Im getting errors in these lines :

D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3 (0.0f, 8.0f, 25.0f),    // the camera position //error
&D3DXVECTOR3 (0.0f, 0.0f, 0.0f),      // the look-at position //error
&D3DXVECTOR3 (0.0f, 1.0f, 0.0f));    // the up direction //error

c++\test 1\test1\main.cpp|145|error: taking address of temporary [-fpermissive]

In all three of them. What do they mean and how can i fix them? I was googling for answers, but none has those errors in these lines. Thank you!

有帮助吗?

解决方案

You are passing to the D3DXMatrixLookAtLH() function the address of temporary D3DXVECTOR3 objects.
Instead, try building these instances of D3DXVECTOR3 on the stack, and pass their addresses, e.g.:

D3DXVECTOR3 cameraPos(0.0f, 8.0f, 25.0f);
D3DXVECTOR3 lookAtPos(0.0f, 0.0f, 0.0f);
D3DXVECTOR3 upDir(0.0f, 1.0f, 0.0f);
// Assume that you have properly defined matView

D3DXMatrixLookAtLH(
  &matView,
  &cameraPos,
  &lookAtPos,
  &upDir);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top