Skip to main content
gamedev.net
🔒 Locked

Trouble with ddutil.cpp

Started by Unwise owl 10 replies 3k views
Original Post
Unwise owl
Unwise owl
I try to use the CDisplay class shipped with the DX8.1 SDK (as I noticed even came into a recent tutorial). However, when I try to call the function CreateFullScreenSurface this error always appear: error LNK2001: unresolved external symbol "public: long __thiscall CDisplay::CreateFullScreenDisplay(void *,unsigned long,unsigned long,unsigned long)" (?CreateFullScreenDisplay@CDisplay@@QAEJPAXKKK@Z) I have included the ddutil.cpp in the project and it compiles well, and I possibly can''t imagine what''s wrong, maybe that I''m using VC++5 and not 6?. It is this error that may prevent me from using these support classes, so please help me! I don''t want to turn over to my old ugly C functions made half a century ago.
Unwise owl
Unwise owl
Yes I am. Otherwise the compiler even wouldn''t know the function exists.
Sphet
Sphet
Are you linking to the library that actually includes the CODE for the function ddutil.h defines? Maybe ddutil.lib ?
Unwise owl
Unwise owl
You have never seen the SDK I presume? Because there is no ddutil.lib. Do you usually include a library when you have the source file ddutil.cpp? If you actually mean the ddraw.lib or dxguid.lib the answer is yes, I have included them!

Come on, can''t someone who knows anything about DirectX help me please?
Zanthos
Zanthos
They in the correct order in the include/lib directory list in VC++? ie.. the sdk directories are at the top? Or you''ll be using the directx stuff that came with VC++5.. no idea what the version will be, but definitely not 8.1
IndirectX
IndirectX
Make sure your application is compiled with STRICT on. Put this line:

#define STRICT

before you include any headers or add STRICT to the list of defines in your project.
---visit #directxdev on afternet <- not just for directx, despite the name
Mr Bakbugawk
Mr Bakbugawk
This isnt a DirectX problem, its a problem with your project setup. I use those common files in my projects and they work just fine. Have you tried compiling the sample DirectDraw projects that come with the SDK and see if you get any errors?
bugawk?
Unwise owl
Unwise owl
quote:
Original post by Zanthos
They in the correct order in the include/lib directory list in VC++? ie.. the sdk directories are at the top? Or you''ll be using the directx stuff that came with VC++5.. no idea what the version will be, but definitely not 8.1


Yes I have set the include and lib directories correctly.

quote:
Original post by Mr Bakbugawk
This isnt a DirectX problem, its a problem with your project setup. I use those common files in my projects and they work just fine. Have you tried compiling the sample DirectDraw projects that come with the SDK and see if you get any errors?


Thank you for the tip . Now I at least know it isn''t a compiler issue. I tried to compile the samples and it went fine. However, this doesn''t help my own project to work, too bad.

Does anyone got a clue why my project setup is faulty? I use release profile and I''ve included the required libraries (the right version), is there anything else I should do? Because if I don''t use these wrapper classes my own (but ugly and unpractical) DD code works fine. Why does the compiler say it doesn''t find the function-body (external reference)?
IndirectX
IndirectX
quote:
Original post by Unwise owl
Does anyone got a clue why my project setup is faulty?

Did you read my post?
---visit #directxdev on afternet <- not just for directx, despite the name
Unwise owl
Unwise owl
quote:
Original post by IndirectX
[quote]Original post by Unwise owl
Does anyone got a clue why my project setup is faulty?

Did you read my post?

Heh sorry . I will try your approach now. Wish me good luck!

EDIT: It worked, once again I'm sorry I bypassed your post at first. You wrote so little I looked at the other posts which looked "more" serious first, because they had more text :D.

[edited by - Unwise owl on June 17, 2002 3:43:32 PM]
IndirectX
IndirectX
quote:
Original post by Unwise owl
Why does the compiler say it doesn''t find the function-body (external reference)?

Because handles are defined differently depending on whether STRICT is defined. If it''s not, most if not all Windows handles are typedefed as void *, which is what you had (look again at the function the linker was trying to find). With STRICT, however, HWND is declared like this:

typedef struct HWND__
{ int unused; }
*HWND;

Thus each handle type is different and errors such as

HWND hwnd;
HDC hdc = hwnd;

will be caught at compile time. Without STRICT, the above assignment will compile with no warning but will most likely have disastrous consequences.

The sample code is compiled with STRICT, thus defines a function with this signature:

public: long __thiscall CDisplay::CreateFullScreenDisplay(struct HWND__*,unsigned long,unsigned long,unsigned long)

Note the difference in the first parameter.

You should always compile with STRICT on for added safety.

Hope this clarifies a bit why you were getting the error.
---visit #directxdev on afternet <- not just for directx, despite the name

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.