Question:
dev c++ direct x [linker error] undefined reference to 'Direct3DCreate9@4'?
Joshie
2007-05-12 02:19:06 UTC
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
#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&DA~1\LOCALS~1\Temp/cc4yaaaa.o(.text+0x1e0):d3d.cpp: undefined reference to `Direct3DCreate9@4'
collect2: ld returned 1 exit status

Execution terminated
Three answers:
Jim
2007-05-12 21:58:01 UTC
Simply go to "project->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.
rafael
2016-10-15 15:02:32 UTC
see first you could desire to comprehend what's a linker and what's a linker errors. After code compilation, that code is related with each and every of the library applications existent on your turboC itemizing...Now, that's the pastime of the linker to verify the physique of the applications u have used like printf, scanf etc...Now you have used one function observed as "symbol_circle" which you have declared and observed as from the main function yet you havent declared the physique of it...in the process linking time, the linker sees that the function is observed as even though it has have been given no corresponding code to execute...write a physique of that function.....then u will discover no linker errors will take place..
ROY L
2007-05-12 03:20:20 UTC
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


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...