문제

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