• Advertisement
Sign in to follow this  

Trying to compile

This topic is 3319 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, I'm trying to compile this sample code from Introduction to 3D Game Programming with DirectX 9.0c Shader Approach. But I get a compile error. Here's the code: #include <d3dx9.h> #include <iostream> using namespace std; // Overload the "<<" operators so that we can use cout to // output D3DXVECTOR3 objects. ostream& operator<<(ostream& os, D3DXVECTOR3& v) { os << "(" << v.x << ", " << v.y << ", " << v.z << ")"; return os; } int main() { // Using constructor, D3DXVECTOR3(FLOAT x,FLOAT y,FLOAT z); D3DXVECTOR3 u(1.0f, 2.0f, 3.0f); // Using constructor, D3DXVECTOR3(CONST FLOAT *); float x[3] = {-2.0f, 1.0f, -3.0f}; D3DXVECTOR3 v(x); // Using constructor, D3DXVECTOR3() {}; D3DXVECTOR3 a, b, c, d, e; // Vector addition: D3DXVECTOR3 operator + a = u + v; // Vector subtraction: D3DXVECTOR3 operator - b = u - v; // Scalar multiplication: D3DXVECTOR3 operator * c = u * 10; // ||u|| float length = D3DXVec3Length(&u); // d = u / ||u|| D3DXVec3Normalize(&d, &u); // s = u dot v float s = D3DXVec3Dot(&u, &v); // e = u x v D3DXVec3Cross(&e, &u, &v); cout << "u = " << u << endl; cout << "v = " << v << endl; cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "c = " << c << endl; cout << "d = " << d << endl; cout << "e = " << e << endl; cout << "||u|| = " << length << endl; cout << "u dot v = " << s << endl; return 0; } And here's the error: Embedding manifest... mt.exe : general error c10100b1: Failed to load file "..\Debug\3dvectors.exe". The system cannot find the path specified. Is this a linking error? The project is an empty project. Thanks in advance for any help. -------------edit--------------- I'm using Visual C++ 2008 Express Edition and have DirectX 9 installed.

Share this post


Link to post
Share on other sites
Advertisement
Also check your permissions since if you don't have permission to that folder you'll see that error of if another instance of the program is running.

Share this post


Link to post
Share on other sites
Hi!

If I get into this kind of trouble, I always use the following.
I download a minimal dx9 tutorial (nehe or something), I try to compile and run.
It should work.
Then I use this project file, include my sources in small steps, it should work.

Füge

Share this post


Link to post
Share on other sites
------edit------
OK so I fixed my first problem. I just had to go to File > move to > folder. However I ran into another problem, and I believe that it is now a linking error.

Error:

1>------ Build started: Project: 3dvectors, Configuration: Debug Win32 ------
1>Compiling...
1>vector3.cpp
1>Linking...
1>vector3.obj : error LNK2019: unresolved external symbol _D3DXVec3Normalize@8 referenced in function _main
1>C:\Users\Remington\Documents\Visual Studio 2008\Projects\3dvectors\Debug\3dvectors.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Remington\Documents\Visual Studio 2008\Projects\3dvectors\3dvectors\Debug\BuildLog.htm"
1>3dvectors - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

[Edited by - Reminator on January 17, 2009 12:19:04 PM]

Share this post


Link to post
Share on other sites
I looked all over the internet to see how others solved the problem, and it seems that it is definitely a linking problem. However, I don't know what's wrong. I'm pretty sure I set up the directories right. What else do I have to do? Anyone have any idea?

----edit----
OK i figured out the problem. I forgot to add the d3dx9.lib file to additional dependencies.

Thanks for your guys support from earlier.

[Edited by - Reminator on January 19, 2009 4:18:39 PM]

Share this post


Link to post
Share on other sites
Thanks for your input TheUnbeliever. I didn't see your post at the time I edited my post (didn't refresh the page).

Share this post


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

  • Advertisement