|
|
 |
| Author |
Message |
fighter92

|
Posted: Visual C++ General, Where should I link? |
Top |
Hi, I'm trying to build a DirectX program. I get linking error:
main.obj : error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function _WinMain@16
I get the error using this line of code:
g_D3D = Direct3DCreate9( D3D_SDK_VERSION);
Where should I link
Visual C++12
|
| |
|
| |
 |
einaros

|
Posted: Visual C++ General, Where should I link? |
Top |
d3d9.lib, I believe. When you're about to ask such questions, see the documentation which ships with DirectX. Navigate to the referenced function, e.g. Direct3DCreate9, and look for a library reference.
|
| |
|
| |
 |
fighter92

|
Posted: Visual C++ General, Where should I link? |
Top |
I have linked there, but it doesn't help
|
| |
|
| |
 |
einaros

|
Posted: Visual C++ General, Where should I link? |
Top |
fighter92 wrote: | I have linked there, but it doesn't help
|
|
The docs specify that library, so I'm guessing you aren't linking the right file after all. Where have you added the dependency
As an alternative approach, you could try adding the following, e.g. to the header in which you call the Direct3DCreate9 function:
#pragma comment(lib, "d3d9.lib")
|
| |
|
| |
 |
fighter92

|
Posted: Visual C++ General, Where should I link? |
Top |
I have the line. Althow I found my mistake on my own. I linked d3d9.lib from x64 folder instead of x86. It works, if I link it from x86 folder.
|
| |
|
| |
 |
| |
|