Including DDRAW.LIB | H into a project
Hey, I've been trying to understand what the hell I'm doing wrong with this code.
At the beginning, I include the DDRAW.H, and the code compiles with no problem, but as soon as I try using a function from that header, I get a linker error.
The function I used was the DirectDrawCreate(NULL, &lpDD, NULL)
And it's the only function I used, before I typed it in it compiled.
(I also made a global pointer, but that too compiled before adding this function)
Error message:
"error LNK2019: unresolved external symbol _DirectDrawCreate@12 referenced in function..."
I'm assuming this error is because the library file hasn't been included somehow into the project? Anyone know what to do?
Tutorials on the subject? Anything that might help me understand how to work with VC++'s linker
I've added the library directory to the linker, I've added the specific library to the linker, and still nothing.
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
Try to pass the following arguments to your compiler: /EHsc /link <em>YourLib</em>.lib :)
Edit:: Maybe this is also helpful ...
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
Where did you get that lib..
Actually DDRAW.LIB is part of DirectX SDK :)
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
After a bit of Googling
Just go to project properties -> Configuration properties -> Linker.
Go to -> General and set the "Additional Library directories" to point to your lib file directory.
Then go to Linker -> Input and type in your lib file name DDRAW.LIB in the "Additional Dependencies" field.
Hope this helps :)
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
Hope this helps :)
Already did that, but nothing changed. It still won't compile. Any more suggestions?
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
Already did that, but nothing changed. It still won't compile. Any more suggestions?
Yes, are you compiling it as a Windows Executable?
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
It's a debug compilation, if that means anything. Otherwise, I doubt it has anything to do with the problem :S
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
It's a debug compilation, if that means anything. Otherwise, I doubt it has anything to do with the problem :S
You just have to make sure that you compile DirectX programs as a Windows Executable :)
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
Hm, I'm really new to this, and I assumed that everytime you build a solution, it creates an executable?
How do I make sure it compiles as an exe? :S
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
Hm, I'm really new to this, and I assumed that everytime you build a solution, it creates an executable?
How do I make sure it compiles as an exe? :S
Just choose Windows Project (when you create a new project)
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
...Well, that I know! :P
Back to the main issue, any other suggestions?
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
"Oh my god!" to the 100th power! Thank you for that link!
It explained everything, all I did wrong was forget the quotations "" when adding the library into the input.
I wrote:
C:\Program Files\Microsoft DirectX SDK (March 2009)\Lib\x86\ddraw.lib
When it should've been
"C:\Program Files\Microsoft DirectX SDK (March 2009)\Lib\x86\ddraw.lib"
I feel silly for not realizing it... Thank you so much.
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
@ShadowScripter
If you're new to this, using DirectDraw may seem quite complex, perhaps start on something easier?
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
<---How do you remove posts?--->
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
Well, this is from a "Windows Game Programming for Dummies" book, so, if you've got a better suggestion as to where to start, please feel free to share.
ShadowScripter
Junior Poster in Training
94 posts since Apr 2009
Reputation Points: 12
Solved Threads: 6
<---How do you remove posts?--->
You can't do it yourself, ask a moderator :)
tux4life
Nearly a Posting Maven
2,350 posts since Feb 2009
Reputation Points: 2,134
Solved Threads: 243
You can't do it yourself, ask a moderator
Unless you recently posted it, allowing you to edit the post (Click Advanced) and remove the message.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129