Directx8 error LNK2019: unresolved external symbol PLEASE HELP!

Started by
6 comments, last by crysisbigfan 11 years, 1 month ago

Hi !

Im making RPG game (Diablo) for my graduation project.
I am working on Jim Adams Programing RPG with Directx 8 book. Any program i compile I get a bunch of different errors. Yes i know Directx 8 is old but i don't have time and knowledge to make something like Diablo. I already tried all the methods found on internet(stackoverflow, this site...). Linked aditional dependencies and so on ... I have sample code from the book and even entire RPG. I don't like the idea moving to Directx9. Yes I have that book too just not the sorce. If anyone has source and samples(for second edition) would you send it to me please ?

Sorry for bad english I type too fast and make mistakes often.


#include "Core_Global.h"
#include "Frustum.h"
#include "ACT1.h"
#include "Core_System.h"
#include "Core_Graphics.h"
#include "Core_Input.h"
#include "Core_Sound.h"
#include "Core_Network.h"
#pragma comment(lib, "User32.lib")
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib, "winmm.lib")
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"
#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "d3dx9d.lib")
#pragma comment(lib, "d3d9.lib")
 


winmm.lib;
wsock32.lib;
dxguid.lib;
d3dx9d.lib;
d3dx.lib;
d3d8.lib;
d3dx8.lib;
dsound.lib;
dinput8.lib;
dplayx.lib;
d3dx8d.lib;
d3dx8dt.lib;
%(AdditionalDependencies)
 

CODE: MAIN FUNCTION


#include "Core_Global.h"
#include "Frustum.h"
#include "ACT1.h"
#include "Core_System.h"
#include "Core_Graphics.h"
#include "Core_Input.h"
#include "Core_Sound.h"
#include "Core_Network.h"
#pragma comment(lib, "User32.lib")
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib, "winmm.lib")
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"
#pragma comment(lib, "d3dx9.lib")
#pragma comment(lib, "d3dx9d.lib")
#pragma comment(lib, "d3d9.lib")
using namespace std;

class cApp : public cApplication
{
  private:
    cGraphics       m_Graphics;
    cCamera         m_Camera;
    cLight          m_Light;

    cSound          m_Sound;
    cSoundData      m_SndData;
    cSoundChannel   m_SndChannel[3];


    cInput          m_Input;
    cInputDevice    m_Keyboard;
    cInputDevice    m_Mouse;

    cMesh           m_Mesh;
    cNodeTreeMesh   m_NodeTreeMesh;

    float           m_XPos, m_YPos, m_ZPos;

  public:
    cApp();

    BOOL Init();
    BOOL Shutdown();
    BOOL Frame();
};

cApp::cApp()
{
  m_Width  = 640;
  m_Height = 480;
  m_Style  = WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU;
  strcpy(m_Class, "NodeTreeClass");
  strcpy(m_Caption, "NodeTree Demo by Jim Adams");
}

BOOL cApp::Init()
{
  short i;

  // Initialize the graphics device and set display mode
  m_Graphics.Init();
  m_Graphics.SetMode(GethWnd(), TRUE, TRUE);
  m_Graphics.SetPerspective(D3DX_PI/4, 1.3333f, 1.0f, 20000.0f);
  ShowMouse(TRUE);

  // Enable lighting and setup light
  m_Graphics.EnableLighting(TRUE);
  m_Graphics.SetAmbientLight(48,48,48);
  m_Graphics.EnableLight(0, TRUE);
  m_Light.SetAttenuation0(0.5f);
  m_Light.SetRange(1000.0f);

  // Initialize input and input devices
  m_Input.Init(GethWnd(), GethInst());
  m_Keyboard.Create(&m_Input, KEYBOARD);
  m_Mouse.Create(&m_Input, MOUSE, TRUE);  

  // Load the mesh and create an NodeTree mesh from it
  m_Mesh.Load(&m_Graphics, "..\\Data\\Level.x", "..\\Data\\");
  m_NodeTreeMesh.Create(&m_Graphics, &m_Mesh, QUADTREE);

  // Position view at origin
  m_XPos = m_YPos = m_ZPos = 0.0f;

 

  // Initialize the sound system to play with
  m_Sound.Init(GethWnd());
  m_SndData.LoadWAV("..\\Data\\Cricket.wav");
  for(i=0;i<3;i++)
    m_SndChannel[i].Create(&m_Sound, &m_SndData);

  return TRUE;
}

BOOL cApp::Shutdown()
{
  // Free sounds
  for(short i=0;i<3;i++)
    m_SndChannel[i].Free();
  m_SndData.Free();
  m_Sound.Shutdown();

  // Free meshes
  m_NodeTreeMesh.Free();
  m_Mesh.Free();

  // Shutdown input
  m_Mouse.Free();
  m_Keyboard.Free();
  m_Input.Shutdown();

  // Shutdown graphics
  m_Graphics.Shutdown();

  return TRUE;
}

BOOL cApp::Frame()
{
  static DWORD  Timer = timeGetTime();
  unsigned long Elapsed;
  float         XMove, ZMove, Height, Diff, Dist;
  D3DXVECTOR2   vecDir;
  cFrustum      Frustum;
  cLight        Light;

  // Play a random cricket sound
  for(short i=0;i<3;i++) {
    if(m_SndChannel[i].IsPlaying() == FALSE && rand() % 256 < 16)
      m_SndChannel[i].Play(&m_SndData, 10);
  }

  // Reacquire input
  m_Mouse.Acquire(TRUE);

  // Calculate elapsed time (plus speed boost)
  Elapsed = (timeGetTime() - Timer);
  Timer = timeGetTime();

  // Get input
  m_Keyboard.Read();
  m_Mouse.Read();

  // Process input and update everything.
  // ESC quits program
  if(m_Keyboard.GetKeyState(KEY_ESC) == TRUE)
    return FALSE;

  // Process movement
  XMove = ZMove = 0.0f;

  if(m_Keyboard.GetKeyState(KEY_UP) == TRUE) {
    XMove = (float)sin(m_Camera.GetYRotation()) * Elapsed;
    ZMove = (float)cos(m_Camera.GetYRotation()) * Elapsed;
  }
  if(m_Keyboard.GetKeyState(KEY_DOWN) == TRUE) {
    XMove = -(float)sin(m_Camera.GetYRotation()) * Elapsed;
    ZMove = -(float)cos(m_Camera.GetYRotation()) * Elapsed;
  }
  if(m_Keyboard.GetKeyState(KEY_LEFT) == TRUE) {
    XMove = (float)sin(m_Camera.GetYRotation() - 1.57f) * Elapsed;
    ZMove = (float)cos(m_Camera.GetYRotation() - 1.57f) * Elapsed;
  }
  if(m_Keyboard.GetKeyState(KEY_RIGHT) == TRUE) {
    XMove = (float)sin(m_Camera.GetYRotation() + 1.57f) * Elapsed;
    ZMove = (float)cos(m_Camera.GetYRotation() + 1.57f) * Elapsed;
  }

  // Check for height changes (can step up to 64 units)
  Height = m_NodeTreeMesh.GetHeightBelow(m_XPos, m_YPos + 64.0f, m_ZPos);
  if(m_YPos > Height) {
    // Dropping
    if((m_YPos -= (float)Elapsed) < Height)
      m_YPos = Height;
    else
      XMove = ZMove = 0.0f;
  } else {
    // Climbing
    m_YPos = Height;
  }

  // Check for movement collisions -
  // can't walk past anything blocking path
  if(m_NodeTreeMesh.CheckIntersect(m_XPos,         m_YPos + 64.0f, m_ZPos,
                                 m_XPos + XMove, m_YPos + 64.0f, m_ZPos + ZMove,
                                 &Dist) == TRUE) {
    // Adjust coordinates to be exactly 2.5 units away from target
    Diff = Dist - 2.5f;
    D3DXVec2Normalize(&vecDir, &D3DXVECTOR2(XMove, ZMove));
    vecDir *= Diff;
    XMove = vecDir.x;
    ZMove = vecDir.y;
  }

  // Update view coordinates
  m_XPos += XMove;
  m_ZPos += ZMove;

  // Position camera
  m_Camera.Move(m_XPos + XMove, m_YPos + 50.0f, m_ZPos + ZMove);
  m_Camera.RotateRel((float)m_Mouse.GetYDelta() / 200.0f,
                     (float)m_Mouse.GetXDelta() / 200.0f,
                     0.0f);

  // Position light
  m_Light.Move(m_XPos, m_YPos+60.0f, m_ZPos);
  m_Graphics.SetLight(0, &m_Light);

  // Set camera and calculate frustum
  m_Graphics.SetCamera(&m_Camera);
  Frustum.Construct(&m_Graphics);

  // Render everything
  m_Graphics.ClearZBuffer(1.0f);
  if(m_Graphics.BeginScene() == TRUE) {
    m_Graphics.EnableZBuffer(FALSE);
    m_Graphics.EnableLighting(FALSE);

    m_Graphics.EnableZBuffer(TRUE);
    m_Graphics.EnableLighting(TRUE);
    m_NodeTreeMesh.Render(&Frustum);
    m_Graphics.EndScene();
  }
  m_Graphics.Display();

  return TRUE;
}

int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdShow)
{
  cApp App;
  return App.Run();
}
 

AND ACT1.CPP


/*-------------------------------------------------------------------
------------------===========================-------------------------------
   IIIIIIII    IIIII     IIII      III       III   IIIII    II      IIIII
     III  III   III     III III     III     III   III III   II     III III
     III    II  III    III   III     III   III   III  III   II    III  III
     III    II  III   IIIIIIIIIII     III III    III  III   II    III  III
   IIIIIIII    IIIII III       III     IIII       IIIIII    IIIIII IIIIII
=================||||||||||||||||||||||||||||===============================



#include "Core_Global.h"
#include "Frustum.h"
#include "ACT1.h"


#pragma comment(lib, "User32.lib")
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib,"d3d8.lib")
#pragma comment(lib,"d3dx8.lib")
#pragma comment(lib, "winmm.lib")

#include <dinput.h>
#include <Windows.h>
#include <iostream>
#include <stdio.h>
#include "d3d8.h"
#include "d3dx8.h"
    #pragma comment(lib, "d3dx9.lib")
    #pragma comment(lib, "d3dx9d.lib")
    #pragma comment(lib, "d3d9.lib")
using namespace std;

cNodeTreeMesh::cNodeTreeMesh()
{
    m_TreeType = OCTREE;
    m_Graphics = NULL;
    m_ParentNode = NULL;
    m_NumPolygons = 0;
    m_PolygonList = NULL;
    m_NumGroups = 0;
    m_Groups = NULL;
    m_Time = 0;
}

cNodeTreeMesh::~cNodeTreeMesh()
{
    Free();
}

BOOL cNodeTreeMesh::Create(cGraphics *Graphics, cMesh *Mesh, int TreeType, float MaxSize, long MaxPolygons)
{
    ID3DXMesh *LoadMesh;
    unsigned short *IndexPtr;
    DWORD *Attributes;
    unsigned long i;
    float MaxX, MaxY, MaxZ;

    Free();


    if((m_Graphics = Graphics ) == NULL)
        return FALSE;
    if(Mesh == NULL)
        return FALSE;
    if(!Mesh->GetParentMesh()->m_NumMaterials)
        return FALSE;

   
    m_Mesh = Mesh->GetParentMesh();
    LoadMesh = m_Mesh->m_Mesh;
    m_VertexFVF = LoadMesh->GetFVF();
    m_VertexSize = D3DXGetFVFVertexSize(m_VertexFVF);
    m_NumPolygons = LoadMesh->GetNumFaces();
    m_MaxPolygons = MaxPolygons;


    m_PolygonList = new sPolygon[m_NumPolygons]();
    m_NumGroups = m_Mesh->m_NumMaterials;
    m_Groups = new sGroup[m_NumGroups]();

   
    LoadMesh->LockIndexBuffer(D3DLOCK_READONLY, (BYTE**)&IndexPtr);
    LoadMesh->LockAttributeBuffer(D3DLOCK_READONLY, &Attributes);

  
    for(i = 0; i  <m_NumPolygons; i++)
    {
        m_PolygonList[i].Vertex[0] = *IndexPtr++;
        m_PolygonList[i].Vertex[1] = *IndexPtr++;
        m_PolygonList[i].Vertex[2] = *IndexPtr++;

        m_PolygonList[i].Group = Attributes[i];
        m_Groups[Attributes[i]].NumPolygons++;
    }

    LoadMesh->UnlockIndexBuffer();
    LoadMesh->UnlockAttributeBuffer();

    for(i = 0; i < m_NumGroups; i++)
    {
        if(m_Groups[i].NumPolygons != 0)
            m_Groups[i].VertexBuffer.Create(m_Graphics, m_Groups[i].NumPolygons * 3, m_VertexFVF, m_VertexSize);
    }


    MaxX = (float)max(fabs(Mesh->GetParentMesh()->m_Min.x), fabs(Mesh->GetParentMesh()->m_Max.x));
    MaxY = (float)max(fabs(Mesh->GetParentMesh()->m_Min.y), fabs(Mesh->GetParentMesh()->m_Max.y));
    MaxZ = (float)max(fabs(Mesh->GetParentMesh()->m_Min.z), fabs(Mesh->GetParentMesh()->m_Max.z));
    m_Size = max(MaxX, max(MaxY, MaxZ)) * 2.0f;
    m_MaxSize = MaxSize;


    m_ParentNode = new sNode();

    LoadMesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&m_VertexPtr);
    SortNode(m_ParentNode, 0.0f, 0.0f, 0.0f, m_Size);
    LoadMesh->UnlockVertexBuffer();

    return TRUE;
}



BOOL cNodeTreeMesh::Free()
{
    delete m_ParentNode;
    m_ParentNode = NULL;

    m_Graphics = NULL;
    m_NumPolygons = 0;
    delete [] m_PolygonList;
    m_PolygonList = NULL;

    m_NumGroups = 0;
    delete [] m_Groups;
    m_Groups = NULL;
    
    return TRUE;
}

void cNodeTreeMesh::SortNode(sNode *Node, float XPos, float YPos, float ZPos, float Size)
{
    unsigned long i, Num;
    float XOff, YOff, ZOff;

    if(Node == NULL || m_PolygonList == NULL)
        return;


    Node->XPos = XPos;
    Node->YPos = (m_TreeType == QUADTREE)?0.0f:YPos;
    Node->ZPos = ZPos;
    Node->Size = Size;

    //ali so plyigoni v nodu
    if(!(Num = CountPolygons(XPos, YPos, ZPos, Size)))
        return;

    if(Size > m_MaxSize && Num > m_MaxPolygons)
    {
        for(i=0; i<(unsigned long)((m_TreeType == QUADTREE)?4:8);i++)
        {
            XOff = ((( i % 2 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);
            YOff = ((( i % 4 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);
            ZOff = ((( i % 8 ) < 1) ? -1.0f : 1.0f ) * (Size * 4.0f);

       
            if(CountPolygons(XPos+XOff, YPos+YOff, ZPos+ZOff, Size/2.0f))
            {
                Node->Nodes[i] = new sNode();

                SortNode(Node->Nodes[i], XPos+XOff, YPos+YOff, ZPos+ZOff, Size/2.0f);
            }
        }
        return;
    }

    
    Node->NumPolygons = Num;
    Node->PolygonList = new sPolygon*[Num];

   
    Num = 0;
    for ( i=0; i<m_NumPolygons; i++)
    {
        if(IsPolygonContained(&m_PolygonList[i], XPos, YPos, ZPos, Size) == TRUE)
    
    Node->PolygonList[Num++] = &m_PolygonList[i];
    }
}

BOOL cNodeTreeMesh::IsPolygonContained(sPolygon *Polygon, float XPos, float YPos, float ZPos, float Size)
{
    float XMin, XMax, YMin, YMax, ZMin, ZMax;
    sVertex *Vertex[3];

    Vertex[0] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[0]];
    Vertex[1] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[1]];
    Vertex[2] =(sVertex*)&m_VertexPtr[m_VertexSize * Polygon->Vertex[2]];


  XMin = min(Vertex[0]->x, min(Vertex[1]->x, Vertex[2]->x));
  XMax = max(Vertex[0]->x, max(Vertex[1]->x, Vertex[2]->x));
  if(XMax < (XPos - Size / 2.0f))
  return FALSE;
  if(XMin > (XPos + Size / 2.0f))
  return FALSE;


  if(m_TreeType == OCTREE) {
    YMin = min(Vertex[0]->y, min(Vertex[1]->y, Vertex[2]->y));
    YMax = max(Vertex[0]->y, max(Vertex[1]->y, Vertex[2]->y));
    if(YMax < (YPos - Size / 2.0f))
    return FALSE;
    if(YMin > (YPos + Size / 2.0f))
    return FALSE;
  }


  ZMin = min(Vertex[0]->z, min(Vertex[1]->z, Vertex[2]->z));
  ZMax = max(Vertex[0]->z, max(Vertex[1]->z, Vertex[2]->z));
  if(ZMax < (ZPos - Size / 2.0f))
  return FALSE;
  if(ZMin > (ZPos + Size / 2.0f))
  return FALSE;

  return TRUE;
}

unsigned long cNodeTreeMesh::CountPolygons(float XPos, float YPos, float ZPos, float Size)
{
    unsigned long i, Num;

  if(!m_NumPolygons)
    return 0;


  Num = 0;
  for( i=0; i<m_NumPolygons; i++ ) {
    if(IsPolygonContained(&m_PolygonList[i],XPos,YPos,ZPos,Size) == TRUE)
     Num++;
  }

  return Num;
}

BOOL cNodeTreeMesh::Render(cFrustum *Frustum, float ZDistance)
{
  D3DXMATRIX Matrix;  
  cFrustum ViewFrustum;  

  
  if(m_Graphics == NULL || m_ParentNode == NULL || !m_NumPolygons)
    return FALSE;


  if((m_Frustum = Frustum) == NULL) {
    ViewFrustum.Construct(m_Graphics, ZDistance);
    m_Frustum = &ViewFrustum;
  }

  D3DXMatrixIdentity(&Matrix);
  m_Graphics->GetDeviceCOM()->SetTransform(D3DTS_WORLD, &Matrix);


  for(unsigned long i=0; i<m_NumGroups; i++) {
    m_Groups[i].VertexBuffer.Lock(0,0);
    m_Groups[i].VertexPtr = (char*)m_Groups[i].VertexBuffer.GetPtr();
    m_Groups[i].NumPolygonsToDraw = 0;
  }
  m_Mesh->m_Mesh->LockVertexBuffer(D3DLOCK_READONLY, (BYTE**)&m_VertexPtr);

  // shrani trenutni ?as  v render
  m_Time = timeGetTime();

  // Dodaj polygone v vertex buffer
  AddNode(m_ParentNode);
 
  // odkleni vertex bufferje in izriši
  m_Mesh->m_Mesh->UnlockVertexBuffer();
  for(unsigned long i=0; i<m_NumGroups; i++) {
    m_Groups[i].VertexBuffer.Unlock();

    if(m_Groups[i].NumPolygonsToDraw) {
      m_Graphics->GetDeviceCOM()->SetMaterial(&m_Mesh->m_Materials[i]);
      m_Graphics->GetDeviceCOM()->SetTexture(0, m_Mesh->m_Textures[i]);
      
      m_Groups[i].VertexBuffer.Render(0, m_Groups[i].NumPolygonsToDraw, D3DPT_TRIANGLELIST);
    }
  }

  return TRUE;
}

void cNodeTreeMesh::AddNode(sNode *Node)
{
  unsigned long i, Group;
  short         Num;

  if(m_TreeType == QUADTREE) {
    if(m_Frustum->CheckRectangle(
           Node->XPos,        0.0f,          Node->ZPos,
           Node->Size / 2.0f, m_Size / 2.0f, Node->Size / 2.0f) == FALSE)
      return;
  } else {
    if(m_Frustum->CheckRectangle(
           Node->XPos,        Node->YPos,        Node->ZPos,
           Node->Size / 2.0f, Node->Size / 2.0f, Node->Size / 2.0f) == FALSE)
      return;
  }

 
  Num = 0;
  for(i=0;i<(unsigned long)((m_TreeType==QUADTREE)?4:8);i++) {
    if(Node->Nodes[i] != NULL) {
      Num++;
      AddNode(Node->Nodes[i]);
    }
  }


  if(Num)
    return;

 
  if(Node->NumPolygons != 0) {
    for(i=0;i<Node->NumPolygons;i++) {

    
      if(Node->PolygonList[i]->Time != m_Time && (Group = Node->PolygonList[i]->Group) < m_NumGroups) {


   
        if(m_Mesh->m_Materials[Node->PolygonList[i]->Group].Diffuse.a != 0.0f) {
          
         
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[0]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[1]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;
          memcpy(m_Groups[Group].VertexPtr, &m_VertexPtr[m_VertexSize * Node->PolygonList[i]->Vertex[2]], m_VertexSize);
          m_Groups[Group].VertexPtr += m_VertexSize;

          m_Groups[Group].NumPolygonsToDraw++;
        }

        Node->PolygonList[i]->Time = m_Time;
      }
    }
  }
}

float cNodeTreeMesh::GetClosestHeight(float XPos, float YPos, float ZPos)
{
  float YAbove, YBelow;

  YAbove = GetHeightAbove(XPos, YPos, ZPos);
  YBelow = GetHeightBelow(XPos, YPos, ZPos);
  if(fabs(YAbove-YPos) < fabs(YBelow-YPos))
    return YAbove;
  return YBelow;
}

float cNodeTreeMesh::GetHeightBelow(float XPos, float YPos, float ZPos)
{
  BOOL  Hit;
  float u, v, Dist;
  DWORD FaceIndex;

  D3DXIntersect(m_Mesh->m_Mesh,
&D3DXVECTOR3(XPos,YPos,ZPos), &D3DXVECTOR3(0.0f, -1.0f, 0.0f),&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);
  if(Hit == TRUE)
    return YPos-Dist;
  return YPos;
}

float cNodeTreeMesh::GetHeightAbove(float XPos, float YPos, float ZPos)
{
  BOOL  Hit;
  float u, v, Dist;
  DWORD FaceIndex;

  D3DXIntersect(m_Mesh->m_Mesh,
                &D3DXVECTOR3(XPos,YPos,ZPos),
                &D3DXVECTOR3(0.0f, 1.0f, 0.0f),
                &Hit, &FaceIndex, &u, &v, &Dist , NULL, NULL);
  if(Hit == TRUE)
    return YPos+Dist;
  return YPos;
}

BOOL cNodeTreeMesh::CheckIntersect(float XStart, float YStart, float ZStart,
                                   float XEnd,   float YEnd,   float ZEnd,
                                   float *Length)
{
  BOOL  Hit;
  float u, v, Dist;
  float XDiff, YDiff, ZDiff, Size;
  DWORD FaceIndex;
  D3DXVECTOR3 vecDir;

  XDiff = XEnd - XStart;
  YDiff = YEnd - YStart;
  ZDiff = ZEnd - ZStart;

  D3DXVec3Normalize(&vecDir, &D3DXVECTOR3(XDiff, YDiff, ZDiff));
  D3DXIntersect(m_Mesh->m_Mesh, &D3DXVECTOR3(XStart,YStart,ZStart), &vecDir,&Hit, &FaceIndex, &u, &v, &Dist, NULL, NULL);

  if(Hit == TRUE) {
    Size = (float)sqrt(XDiff*XDiff+YDiff*YDiff+ZDiff*ZDiff);
    if(Dist > Size)
      Hit = FALSE;
    else {
      if(Length != NULL)
        *Length = Dist;
    }
  }

  return Hit;
}

 

ERRORS



Build started 2.3.2013 10:17:39.
1>InitializeBuildStatus:
1>  Touching "Debug\Diavolo.unsuccessfulbuild".
1>ClCompile:
1>  WinMain.cpp
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Create(class cGraphics *,unsigned long,unsigned long,long)" (?Create@cVertexBuffer@@QAEHPAVcGraphics@@KKJ@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Create(class cGraphics *,class cMesh *,int,float,long)" (?Create@cNodeTreeMesh@@QAEHPAVcGraphics@@PAVcMesh@@HMJ@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: struct sMesh * __thiscall cMesh::GetParentMesh(void)" (?GetParentMesh@cMesh@@QAEPAUsMesh@@XZ) referenced in function "public: int __thiscall cNodeTreeMesh::Create(class cGraphics *,class cMesh *,int,float,long)" (?Create@cNodeTreeMesh@@QAEHPAVcGraphics@@PAVcMesh@@HMJ@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: __thiscall cVertexBuffer::cVertexBuffer(void)" (??0cVertexBuffer@@QAE@XZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::sGroup(void)" (??0sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: __thiscall cVertexBuffer::~cVertexBuffer(void)" (??1cVertexBuffer@@QAE@XZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::~sGroup(void)" (??1sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Free(void)" (?Free@cVertexBuffer@@QAEHXZ) referenced in function "public: __thiscall cNodeTreeMesh::sGroup::~sGroup(void)" (??1sGroup@cNodeTreeMesh@@QAE@XZ)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Render(unsigned long,unsigned long,unsigned long)" (?Render@cVertexBuffer@@QAEHKKK@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Unlock(void)" (?Unlock@cVertexBuffer@@QAEHXZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: void * __thiscall cVertexBuffer::GetPtr(void)" (?GetPtr@cVertexBuffer@@QAEPAXXZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: int __thiscall cVertexBuffer::Lock(unsigned long,unsigned long)" (?Lock@cVertexBuffer@@QAEHKK@Z) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>ACT1.obj : error LNK2019: unresolved external symbol "public: struct IDirect3DDevice8 * __thiscall cGraphics::GetDeviceCOM(void)" (?GetDeviceCOM@cGraphics@@QAEPAUIDirect3DDevice8@@XZ) referenced in function "public: int __thiscall cNodeTreeMesh::Render(class cFrustum *,float)" (?Render@cNodeTreeMesh@@QAEHPAVcFrustum@@M@Z)
1>Frustum.obj : error LNK2001: unresolved external symbol "public: struct IDirect3DDevice8 * __thiscall cGraphics::GetDeviceCOM(void)" (?GetDeviceCOM@cGraphics@@QAEPAUIDirect3DDevice8@@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cMesh::~cMesh(void)" (??1cMesh@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInputDevice::~cInputDevice(void)" (??1cInputDevice@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInput::~cInput(void)" (??1cInput@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundData::~cSoundData(void)" (??1cSoundData@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSound::~cSound(void)" (??1cSound@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cGraphics::~cGraphics(void)" (??1cGraphics@@QAE@XZ) referenced in function __unwindfunclet$??0cApp@@QAE@XZ$0
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cMesh::cMesh(void)" (??0cMesh@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInputDevice::cInputDevice(void)" (??0cInputDevice@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cInput::cInput(void)" (??0cInput@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundChannel::cSoundChannel(void)" (??0cSoundChannel@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundChannel::~cSoundChannel(void)" (??1cSoundChannel@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSoundData::cSoundData(void)" (??0cSoundData@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cSound::cSound(void)" (??0cSound@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cLight::cLight(void)" (??0cLight@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cCamera::cCamera(void)" (??0cCamera@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cGraphics::cGraphics(void)" (??0cGraphics@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: __thiscall cApplication::cApplication(void)" (??0cApplication@@QAE@XZ) referenced in function "public: __thiscall cApp::cApp(void)" (??0cApp@@QAE@XZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::Create(class cSound *,class cSoundData *)" (?Create@cSoundChannel@@QAEHPAVcSound@@PAVcSoundData@@@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundData::LoadWAV(char *,struct _iobuf *)" (?LoadWAV@cSoundData@@QAEHPADPAU_iobuf@@@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSound::Init(struct HWND__ *,long,short,short,long)" (?Init@cSound@@QAEHPAUHWND__@@JFFJ@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cMesh::Load(class cGraphics *,char *,char *)" (?Load@cMesh@@QAEHPAVcGraphics@@PAD1@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Create(class cInput *,short,int)" (?Create@cInputDevice@@QAEHPAVcInput@@FH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInput::Init(struct HWND__ *,struct HINSTANCE__ *)" (?Init@cInput@@QAEHPAUHWND__@@PAUHINSTANCE__@@@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: struct HINSTANCE__ * __thiscall cApplication::GethInst(void)" (?GethInst@cApplication@@QAEPAUHINSTANCE__@@XZ) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cLight::SetRange(float)" (?SetRange@cLight@@QAEHM@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cLight::SetAttenuation0(float)" (?SetAttenuation0@cLight@@QAEHM@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EnableLight(long,int)" (?EnableLight@cGraphics@@QAEHJH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetAmbientLight(char,char,char)" (?SetAmbientLight@cGraphics@@QAEHDDD@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EnableLighting(int)" (?EnableLighting@cGraphics@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cApplication::ShowMouse(int)" (?ShowMouse@cApplication@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetPerspective(float,float,float,float)" (?SetPerspective@cGraphics@@QAEHMMMM@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetMode(struct HWND__ *,int,int,long,long,char)" (?SetMode@cGraphics@@QAEHPAUHWND__@@HHJJD@Z) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: struct HWND__ * __thiscall cApplication::GethWnd(void)" (?GethWnd@cApplication@@QAEPAUHWND__@@XZ) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::Init(void)" (?Init@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Init(void)" (?Init@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::Shutdown(void)" (?Shutdown@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInput::Shutdown(void)" (?Shutdown@cInput@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Free(void)" (?Free@cInputDevice@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cMesh::Free(void)" (?Free@cMesh@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSound::Shutdown(void)" (?Shutdown@cSound@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundData::Free(void)" (?Free@cSoundData@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::Free(void)" (?Free@cSoundChannel@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Shutdown(void)" (?Shutdown@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::Display(void)" (?Display@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EndScene(void)" (?EndScene@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::EnableZBuffer(int)" (?EnableZBuffer@cGraphics@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::BeginScene(void)" (?BeginScene@cGraphics@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::ClearZBuffer(float)" (?ClearZBuffer@cGraphics@@QAEHM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetCamera(class cCamera *)" (?SetCamera@cGraphics@@QAEHPAVcCamera@@@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cGraphics::SetLight(long,class cLight *)" (?SetLight@cGraphics@@QAEHJPAVcLight@@@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cLight::Move(float,float,float)" (?Move@cLight@@QAEHMMM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cCamera::RotateRel(float,float,float)" (?RotateRel@cCamera@@QAEHMMM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: long __thiscall cInputDevice::GetYDelta(void)" (?GetYDelta@cInputDevice@@QAEJXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: long __thiscall cInputDevice::GetXDelta(void)" (?GetXDelta@cInputDevice@@QAEJXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cCamera::Move(float,float,float)" (?Move@cCamera@@QAEHMMM@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: float __thiscall cCamera::GetYRotation(void)" (?GetYRotation@cCamera@@QAEMXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::GetKeyState(char)" (?GetKeyState@cInputDevice@@QAEHD@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Read(void)" (?Read@cInputDevice@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cInputDevice::Acquire(int)" (?Acquire@cInputDevice@@QAEHH@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::Play(class cSoundData *,long,long)" (?Play@cSoundChannel@@QAEHPAVcSoundData@@JJ@Z) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cSoundChannel::IsPlaying(void)" (?IsPlaying@cSoundChannel@@QAEHXZ) referenced in function "public: virtual int __thiscall cApp::Frame(void)" (?Frame@cApp@@UAEHXZ)
1>WinMain.obj : error LNK2019: unresolved external symbol "public: int __thiscall cApplication::Run(void)" (?Run@cApplication@@QAEHXZ) referenced in function _WinMain@16
1>.\Debug\Diavolo.exe : fatal error LNK1120: 71 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.91
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



 

Oh, and please ignore the comments they are in other language.

Any help would be really appriciated



Advertisement

Start by actually reading what the linker is trying to tell you:

The last error for example tells you about a missing implementation of the Run()-Method in the class cApp. A quick look at your main code confirms this - you need to implement cApp::Run() there.

The other linker errors have nothing to do with DX8 or DX9 either - you simply seem to have forgotten to include a bunch of cpp files in your project. All those missing methods the linker is telling you about are implemented in source files that are not part of your build. That's what you need to fix.

You should also just include either dx8 or dx9 libs - not both (e.g. get rid of the #pragma comment(lib, "d3dx9.lib"), #pragma comment(lib, "d3dx9d.lib") and #pragma comment(lib, "d3d9.lib")).

WOW !

thanks ! smile.png
im only getting thease errors now

c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h(105) : see declaration of 'strcpy'
1>c:\users\klemen\documents\matura\diavolo\igra\core_graphics.cpp(1124): error C2664: 'ID3DXSkinMesh::UpdateSkinnedMesh' : cannot convert parameter 2 from 'ID3DXMesh *' to 'const D3DXMATRIX *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\klemen\documents\matura\diavolo\igra\core_graphics.cpp(1280): error C2660: 'ID3DXSkinMesh::GenerateSkinnedMesh' : function does not take 6 arguments
1>c:\users\klemen\documents\matura\diavolo\igra\core_graphics.cpp(1788): error C2660: 'ID3DXSkinMesh::UpdateSkinnedMesh' : function does not take 2 arguments
1>

I added couple of NULL but now i get

1>c:\users\klemen\documents\matura\diavolo\igra\core_graphics.cpp(1124): error C2664: 'ID3DXSkinMesh::UpdateSkinnedMesh' : cannot convert parameter 2 from 'ID3DXMesh *' to 'const D3DXMATRIX *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\klemen\documents\matura\diavolo\igra\core_graphics.cpp(1280): error C2664: 'ID3DXSkinMesh::GenerateSkinnedMesh' : cannot convert parameter 5 from 'ID3DXMesh **' to 'DWORD *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\klemen\documents\matura\diavolo\igra\core_graphics.cpp(1789): error C2664: 'ID3DXSkinMesh::UpdateSkinnedMesh' : cannot convert parameter 2 from 'ID3DXMesh *' to 'const D3DXMATRIX *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Im new to directx sorry sad.png

Thank you for your time

The remaining errors are a result of interface changes in the ID3DX library between your installed version and the one the core_graphics implementation was built upon.

UpdateSkinnedMesh() should take 3 parameters and be used like this:

UpdateSkinnedMesh(matrix, NULL, mesh), where matrix points to your bone transform matrix and mesh is your mesh pointer.

I don't know the parameters for GenerateSkinnedMesh(). As a rule of thumb, however, you should never just throw in NULL parameters at random. Instead, take a look at the parameter types the function expects and match the variables that are used by the old code against them. Any parameter of the function that is not used by the existing code can be NULL (if it's a pointer).

Question, are you using the latest DirectX SDK? Or are you using the actual DirectX 8 SDK? There's a chance you might be getting the DX9 version of those interfaces which is likely changed since DX8. I've had this problem before, and it can get annoying sometimes. Be sure that you're only linking against the DX8 versions.

If I were you, I'd be looking at the MSDN documentation of those interfaces you are having problems with. I understand that you are new to all of this, but eventually you will need to learn to look to the API documentation when things of this nature arrive. So, from here, I recommend at least opening up the DirectX 8 SDK help file along side of the DirectX 9 SDK help file to see what the COM interface differences are so you can pinpoint your problem. If you don't understand what the different parameters are for, then let us know. Since I have both SDKs installed on my Windows machine, I'd be glad to do a little searching myself for you, but I'm on my Mac right now, which doesn't use DirectX.

Shogun

Hi !

First of all i would really like to thank you for your help. This means a lot to me. Yes, Im using Directx8 sdk with 2004 update(Maybe thats the problem ill try to reinstall SDK without this update). In Directx SDK help for C++ was

HRESULT GenerateSkinnedMesh(

DWORD Options,

FLOAT minWeight,
CONST LPDWORD pAdjacencyIn,

LPDWORD pAdjacencyOut,

DWORD* pFaceRemap,
LPD3DXBUFFER* ppVertexRemap,

LPD3DXMESH* ppMesh );

pFaceRemap [out, retval] Pointer to the an array of DWORDs containing the face remap
array. This parameter is optional and can be specified with NULL. ppVertexRemap [out, retval] Pointer to an LPD3DXBUFFER interface,
representing the vertex remap data. This parameter is optional and can be
specified with NULL. ppMesh [out, retval] Pointer to an ID3DXMesh interface, representing
the generated skinned mesh.

So the problem is becouse i have only one argument after pAdjacencyOut, where there should be three. pFaceRemap can be NULL and ppVertexRemap can be NUll too.

Nice! Too bad i didn't use that earlier. The functions are fixed only two errors remains before i can draw my level

1>LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
1>Core_Graphics.obj : error LNK2019: unresolved external symbol _DirectXFileCreate@4 referenced in function "public: int __thiscall cMesh::Load(class cGraphics *,char *,char *)" (?Load@cMesh@@QAEHPAVcGraphics@@PAD1@Z)
1>.\Debug\Diavolo.exe : fatal error LNK1120: 2 unresolved externals

I did some resarch:

1>LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main is Usually when people are using console application settings. I checked I have windows application. But the other one no idea.

Thanks again for all working advices smile.png

Oops, sorry. I forgot to check back on this thread. This is embarrassing... ph34r.png

Okay, here's my take on your linker errors.

"LIBCMTD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main". This is one that even I had trouble with when I was new sometimes. Before I give you a direct answer, let me ask you this. Did you create a new project yourself? Or did you use a pre-existing project fron the book? If it's the former, then you need to build DirectX programs using a Win32 project, not the Win32 console project. Visual studio is looking for the "int main(int argc, char** argv)" or "void main()" entry point that console programs have. Windows programs always start at "int APIENTRY WinMain(...)", and Visual Studio ignores that entry point when building as a console program. If the answer is the latter, then I guess you need to create a new project. huh.png

"Core_Graphics.obj : error LNK2019: unresolved external symbol _DirectXFileCreate@4 referenced in function "public: int __thiscall cMesh::Load(class cGraphics *,char *,char *)" (?Load@cMesh@@QAEHPAVcGraphics@@PAD1@Z)". This one is a little simpler. You're missing (or not including) the .lib file known as D3DXof.lib. Since I never used DirectXFileCreate() before, I had to google it for the MSDN documentation to be sure. It's part of the legacy .x file API, but thank God Microsoft still keeps up with the documentation on it!

Try these suggestions here and let us know if it worked or not.

Shogun.

Hey Thanks it worked ! :)

Now I have working program but the profesor is very angry. I keep telling him Im going to do it. lol

I'll probably give UDK a try if this doesn't works out.

Thanks for all replies from all of you ! :) :)

This topic is closed to new replies.

Advertisement