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.

Try to pass the following arguments to your compiler: /EHsc /link [I]YourLib[/I].lib :)

Edit:: Maybe this is also helpful ...

@tux
Sorry dude..

Where did you get that lib..
Try this..
Project | Add Existing Item..Then add DDRAW.H into your project..

Where did you get that lib..

Actually DDRAW.LIB is part of DirectX SDK :)

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 :)

Hope this helps :)

Already did that, but nothing changed. It still won't compile. Any more suggestions?

Already did that, but nothing changed. It still won't compile. Any more suggestions?

Yes, are you compiling it as a Windows Executable?

It's a debug compilation, if that means anything. Otherwise, I doubt it has anything to do with the problem :S

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 :)

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

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)

...Well, that I know! :P

Back to the main issue, any other suggestions?

"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.

Actually DDRAW.LIB is part of DirectX SDK :)

wow..You guys so fast..
thats why i'm asking him dude..:)..Go on..

@ShadowScripter
If you're new to this, using DirectDraw may seem quite complex, perhaps start on something easier?

<---How do you remove posts?--->

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.

<---How do you remove posts?--->

You can't do it yourself, ask a moderator :)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.