linking errors in "Special Effects Programming With DirectX"

Started by
4 comments, last by CreepingDeath666 20 years, 8 months ago
Whenever I try to run the Ch11p1_SimpleFire.dsw program I get these errors: d3dfile.cpp(203) : error C2660: ''D3DXComputeNormals'' : function does not take 1 parameters d3dfile.cpp(205) : error C2660: ''D3DXComputeNormals'' : function does not take 1 parameters If someone could please help me fix these, I would greatly appreciate it.
Advertisement
First of all these are not linking errors. They are compiler errors. But this make no difference, i think!!!

I don''t have the book, and i don''t know anything about DirectX!

First of all, try to find D3DXComputeNormals(), and see how many params it takes. Is it a custom function, or a D3D one. If it is custom, then check to see if the remaining params could be set to a standard value.

Something like this :

D3DXComputeNormals(CFace* triangleList, bool smoothNormals = true);

If you post some code around those lines you mentioned, and the D3DXComputeNormals() (if it is a custom func) code, maybe i can help you more

HellRaiZer
HellRaiZer
Here is some of the surrounding code. The function that is causing the error is a standard d3dx function but I cannot find out how man parameters it takes because I''m not exactly sure what header file it is in and I don''t want to look through all of them.

HRESULT CD3DMesh::SetFVF( LPDIRECT3DDEVICE8 pd3dDevice, DWORD dwFVF )
{
LPD3DXMESH pTempSysMemMesh = NULL;
LPD3DXMESH pTempLocalMesh = NULL;

if( m_pSysMemMesh )
{
if( FAILED( m_pSysMemMesh->CloneMeshFVF( D3DXMESH_SYSTEMMEM, dwFVF,
pd3dDevic, &pTempSysMemMesh ) ) )
return E_FAIL;
}
if( m_pLocalMesh )
{
if( FAILED( m_pLocalMesh->CloneMeshFVF( 0L, dwFVF, pd3dDevice,
&pTempLocalMesh ) ) )
{
SAFE_RELEASE( pTempSysMemMesh );
return E_FAIL;
}
}

SAFE_RELEASE( m_pSysMemMesh );
SAFE_RELEASE( m_pLocalMesh );

if( pTempSysMemMesh ) m_pSysMemMesh = pTempSysMemMesh;
if( pTempLocalMesh ) m_pLocalMesh = pTempLocalMesh;

// Compute normals in case the meshes have them
if( m_pSysMemMesh )
D3DXComputeNormals( m_pSysMemMesh );
if( m_pLocalMesh )
D3DXComputeNormals( m_pLocalMesh );

return S_OK;
}


Here it is what the DirectX 8.0 SDK says about this func.
Also i checked SDK 6.1 and 7.0, and the function doesn''t exist in those versions. So you must using v8.0 SDK. I don''t know what the problem is, because the function takes only ONE param, but check your included files for more details

D3DXComputeNormalsComputes normals for each vertex in a mesh.HRESULT D3DXComputeNormals(  LPD3DXBASEMESH pMesh);ParameterspMesh [in, out] Pointer to an ID3DXBaseMesh interface, representing the normalized mesh object. Return ValuesIf the function succeeds, the return value is D3D_OK.If the function fails, the return value can be one D3DERR_INVALIDCALL.Note  The input mesh must have the D3DFVF_NORMAL flag specified in its FVF.A normal for a vertex is generated by averaging the normals of all faces that share that vertex.Requirements   Header: Declared in D3dx8mesh.h.  Import Library: Use D3dx8.lib.


Check D3dx8mesh.h for more details. Also check to see if the function has been overridden from the author. Perhaps, he made his own func, which takes more params, and he forgot to make it obvious.

HellRaiZer

PS. If you use VC++ there is a "Find in Files..." option which helps you find things like that!
HellRaiZer
in both DX8 and DX9, D3DXComputeNormals takes 2 parms. the first is a pointer to the mesh object and the second is an optional pointer to a face adjacency array. the second parm is typically set to NULL.

that code you posted was taken directly from the DX SDK common framework code. the only difference being the missing NULL 2nd parms for the two D3DXComputeNormals calls.
oops, sorry. that''s DX 8.1 for my above post. given HellRaiZer''s post it looks like MS changed the function between 8.0 and 8.1.

This topic is closed to new replies.

Advertisement