Sign in to follow this  

Why did #pragma comment (lib, "d3dx9") solve my problem?

This topic is 3857 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

Alright, so I was ripping my hair out trying to figure out why VC++ 2005 kept giving me unresolved symbol errors. Someone said to add #pragma comment (lib, "d3dx9") right after #include <d3dx9.h>. Sure enough, it solved the problem. However, I don't know why. Why doesn't #include <d3dx9.h> work by itself? What's going on here? I have spent some time cruising through Google trying to figure out how #pragma works, but I just don't get it. I am a total n008. My entire understanding of VC++ is "Type commands, the compiler does this linking thing that creates a program that executes the commands, hopefully doing what you intended". That's it. None of this "*.out",etc stuff all over the internet. Thank you for your help, tlak

Share this post


Link to post
Share on other sites
The header only includes declarations. The actual definitions - code to go along with functions, values for objects, etc - is in the object file, and .lib files are simply concatenated object files.

The comment pragma instructs the linker to link your program against the specified library file. You could also have specified the library file in the projct options dialog.

Share this post


Link to post
Share on other sites
Ahh, just like a header file in your program; there must be an accompanying .cpp file to define the prototypes from the header! I get it!

One more question, what is 'concatenated'?

Share this post


Link to post
Share on other sites
Quote:
Original post by TLAK1001
Ahh, just like a header file in your program; there must be an accompanying .cpp file to define the prototypes from the header! I get it!

One more question, what is 'concatenated'?


More appropropriately in this case there must be a precompiled library. The pragma is being used in place of adding the d3dx9.lib file to the linker profile.

Share this post


Link to post
Share on other sites

This topic is 3857 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this