Tuesday, July 14, 2009

Dev c++ direct x [linker error] undefined reference to 'Direct3DCreate9@4'?

i got the DirectXSDK from devpack.org with is the write one for devc++ i include this files which i was told to do on some forum but it didn't fix any thing


#include %26lt;d3d9.h%26gt;


#pragma comment (lib, "libd3dx9.a")


#pragma comment (lib, "libd3d9.a")





Compile Log


Compiler: Default compiler


Executing g++.exe...


g++.exe "C:\Dev-Cpp\mycode\d3d.cpp" -o "C:\Dev-Cpp\mycode\d3d.exe" -I"lib\gcc\mingw32\3.4.2\include" -I"include\c++\3.4.2\backward" -I"include\c++\3.4.2\mingw32" -I"include\c++\3.4.2" -I"include" -L"lib"


C:\DOCUME~1\MUM%26amp;DA~1\LOCALS~1\Temp/cc4... undefined reference to `Direct3DCreate9@4'


collect2: ld returned 1 exit status





Execution terminated

Dev c++ direct x [linker error] undefined reference to 'Direct3DCreate9@4'?
Simply go to "project-%26gt;project options" and link libd3dx9.a and libd3d9.a. These are the libraries you need.





The preprocessor directives





#pragma comment (lib, "libd3dx9.a")


#pragma comment (lib, "libd3d9.a")





are intended for Visual C++ I believe.
Reply:Direct3DCreate9 is defined in d3d9.h. With Microsoft compiler, import library d3d9.lib is required for d3d9.h. Linking for my D3D9 benchmark includes:





link /LARGEADDRESSAWARE d3d9.lib dxerr9.lib winmm.lib d3dx9.lib kernel32.lib bufferoverflowu.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib


No comments:

Post a Comment