Jump to content
  • Advertisement
Sign in to follow this  
Ali_K

unresolved external symbol error

This topic is 3868 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Im trying to build below code But linker shows errors. Output Window : Compiling... Util1.cpp Linking... Util1.obj : error LNK2019: unresolved external symbol _D3DXVec3Normalize@8 referenced in function "void __cdecl Util1_InitLight(struct _D3DLIGHT9 &,enum _D3DLIGHTTYPE,float,float,float)" (?Util1_InitLight@@YAXAAU_D3DLIGHT9@@W4_D3DLIGHTTYPE@@MMM@Z) G:\Programs\Present Projects\2005\ASL_Solution\Debug\ASL_Game.exe : fatal error LNK1120: 1 unresolved externals //Mainpage.h #include "stdafx.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) { return 0; } //End of file Mainpage.h //StdAfx.h #include <tchar.h> #include <Windows.h> #include <mmsystem.h> #include <windowsx.h> #include <basetsd.h> #include <cguid.h> #include <assert.h> #include <math.h> #include <stdarg.h> #include <stdio.h> #include <tchar.h> #include <d3d9.h> #include <d3dx9.h> #include <dinput.h> #include <dmerror.h> #include <dmusicc.h> #include <dmusici.h> #include <dsound.h> #include <dxerr9.h> #include <fstream> #include <vector> #include <iostream> #include <string> #include <conio.h> //End of file StdAfx.h //Util1.h #ifndef UTIL1_H #define UTIL1_H #include <D3D9.h> #include <D3DX9Math.h> namespace ASLSpace_Utility { //----------------------------------------------------------------------------- // Name: D3DUtil_InitMaterial() // Desc: Initializes a D3DMATERIAL9 structure, setting the diffuse and ambient // colors. It does not set emissive or specular colors. //----------------------------------------------------------------------------- VOID Util1_InitMaterial( D3DMATERIAL9& mtrl, FLOAT r=0.0f, FLOAT g=0.0f, FLOAT b=0.0f, FLOAT a=1.0f ); //----------------------------------------------------------------------------- // Name: Util1_InitLight() // Desc: Initializes a D3DLIGHT structure, setting the light position. The // diffuse color is set to white, specular and ambient left as black. //----------------------------------------------------------------------------- VOID Util1_InitLight( D3DLIGHT9& light, D3DLIGHTTYPE ltType, FLOAT x=0.0f, FLOAT y=0.0f, FLOAT z=0.0f ); } #endif // UTIL1_H //End of file util1.h //Util1.cpp #define STRICT #include <Windows.h> #include <WindowsX.h> #include <tchar.h> #include <stdio.h> #include "Util1.h" #include "D3DX9.h" using namespace ASLSpace_Utility; //----------------------------------------------------------------------------- // Name: Util1_InitMaterial() // Desc: Initializes a D3DMATERIAL9 structure, setting the diffuse and ambient // colors. It does not set emissive or specular colors. //----------------------------------------------------------------------------- VOID Util1_InitMaterial( D3DMATERIAL9& mtrl, FLOAT r, FLOAT g, FLOAT b, FLOAT a ) { ZeroMemory( &mtrl, sizeof(D3DMATERIAL9) ); mtrl.Diffuse.r = mtrl.Ambient.r = r; mtrl.Diffuse.g = mtrl.Ambient.g = g; mtrl.Diffuse.b = mtrl.Ambient.b = b; mtrl.Diffuse.a = mtrl.Ambient.a = a; } //----------------------------------------------------------------------------- // Name: Util1_InitLight() // Desc: Initializes a D3DLIGHT structure, setting the light position. The // diffuse color is set to white; specular and ambient are left as black. //----------------------------------------------------------------------------- VOID Util1_InitLight( D3DLIGHT9& light, D3DLIGHTTYPE ltType, FLOAT x, FLOAT y, FLOAT z ) { D3DXVECTOR3 vecLightDirUnnormalized(x, y, z); ZeroMemory( &light, sizeof(D3DLIGHT9) ); light.Type = ltType; light.Diffuse.r = 1.0f; light.Diffuse.g = 1.0f; light.Diffuse.b = 1.0f; D3DXVec3Normalize( (D3DXVECTOR3*)&light.Direction, &vecLightDirUnnormalized ); light.Position.x = x; light.Position.y = y; light.Position.z = z; light.Range = 1000.0f; } //End of file util1.cpp

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by SiCrane
Did you link against D3dx9.lib?


thanks
i add this and it worked.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!