King_Leo5

I am using C++ express edition to learn Direct X9. So far to fix the program ive had to download Microsoft Platform SDK and the Direct X9 SDK. Most of the program works but when i try to use D3DXVec3Normalize i get the error:

1>Example Use of d3dx9 library.obj : error LNK2019: unresolved external symbol _D3DXVec3Normalize@8 referenced in function "void __cdecl getans2(void)" ( getans2@@YAXXZ)

I cant work out what is wrong or how to fix it. Anyone got ideas



Re: Visual C++ Language An LNK2019 error. Can someone help, ive been trying to fix this error for a while

Mike Danes

Have you added d3dx9.lib as linker input





Re: Visual C++ Language An LNK2019 error. Can someone help, ive been trying to fix this error for a while

King_Leo5

Ive never changed anything with the linker before. Do i just put d3dx9.lib in the Project> "Project Name" properties menu. Then under expanded Linker, input -> Additional Dependincies bit

If it is that i just get erros:

1>d3dx9.lib(cpudetect.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "int __stdcall GetD3DRegValue(unsigned long,char *,void *,unsigned long)" ( GetD3DRegValue@@YGHKPADPAXK@Z)

1>d3dx9.lib(cpudetect.obj) : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function "int __stdcall GetD3DRegValue(unsigned long,char *,void *,unsigned long)" ( GetD3DRegValue@@YGHKPADPAXK@Z)

1>d3dx9.lib(cpudetect.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyA@12 referenced in function "int __stdcall GetD3DRegValue(unsigned long,char *,void *,unsigned long)" ( GetD3DRegValue@@YGHKPADPAXK@Z)

Thanks for quick reply





Re: Visual C++ Language An LNK2019 error. Can someone help, ive been trying to fix this error for a while

Mike Danes

Yes, it's that and some others. You need at least advapi32.lib, kernel32.lib, d3d9.lib, d3d9x.lib.

In general if you get a linker error like this you need to check the MSDN docs to see in what lib the function is defined. For example if you look at RegCloseKey you will see something like:

Client Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header

Declared in Winreg.h; include Windows.h.

Library

Use Advapi32.lib.

DLL Requires Advapi32.dll.





Re: Visual C++ Language An LNK2019 error. Can someone help, ive been trying to fix this error for a while

King_Leo5

Thanks a lot, for the answer and for being so quick about it.