Advertisement

error LNK2001: unresolved external symbol _IID_IDirectDraw7

Started by February 25, 2000 08:05 AM
4 comments, last by BeanDog 24 years, 6 months ago
I am preparing my first DDraw C++ program while simultaneously trying to learn C++. Oh man. I am using MSVC++6.0, and DXSDK7.0a. I am trying to learn the basics of how to link together different header/c++ source files and such to make classes and things work. A few questions... 1. In a basic Windows NON-MFC app, what includes do you need in the main c++ file? 2. If you have, say, header.h and source.cpp, and you want to make a simple class involving a few windows and DDraw API calls in the class, do you need to include the .h files in both files, or just the cpp file, where the actual coding is, or what? 3. If said header and source work, do we need to include the header.h in the winmain.cpp or whatever file? 4. This one''s pretty specific. I am making a VERY basic windows/ddraw app. All of my calls are working, even DX7 specific ones, but I get an unresolved external on IID_IDIRECTDRAW7, even though it is defined in the ddraw.h I am using. Yes, my MSSDK directories are on the top of the lists in my directory folder. 5. Any other useful hints? Remember, I am very new to C/C++ (about a month of hobby) and I am used to using BASIC! I was a BASIC programmer since I was 7, and learning to be this kind of control freak, well, freaks me out. Thanks a lot guys. PS this is the best C++ game programming site I''ve ever seen. -Ben "BEAN DOG" Dilts Simple Versioning System: Source code control for the common man. [Edited by - BeanDog on January 15, 2006 12:48:35 PM]
1. #include <windows.h> is a good guess. Most people also define WIN32_LEAN_AND_MEAN before to remove some rarely used declarations. I think this is mostly to speed up compiling.

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

2. The windows and DDraw includes go into the header file. Then you include the header file in the source (cpp) file.

3. The header file should only be included in those source files that use the declarations in it.

4. You need to link with dxguid.lib. OR define INITGUID once in the program. Personally I find it easier to link with the library.

5.

  • Pick up a book on C++ programming. It is a far to complex topic to just ask questions about.
  • Look at samples and try to understand what everything does.
  • Don't try to make a game with DirectX until you know the language well enough.
  • Don't be afraid to ask if there is something you don't understand, but try to find the answer yourself first. It's easier to remember that way.






Edited by - Spellbound on 2/25/00 8:34:58 AM
Advertisement
Did u add ddraw.lib and dxguid.lib to the project?

BTW, a lot of pple seems to forget #define STRICT just before including windows.h. I don''t know why, but it saves me a lot of trouble most of the time, especially unresolved externals from others 3rd-party libraries. (Or maybe MSVC++6 define it by default, i use MSVC++5)



"after many years of singularity, i'm still searching on the event horizon"
HOLY MOLY THANKS A LOT!

For some reason, none of the SDK manual said anything about linking with dxguid.lib. and thx much for the other info too.

-Ben "Bean Dog" DIlts
DerekSaw: STRICT tells the compiler to be more strict when checking typecasting and such. Specifically it changes declaration in windows headers so that certain typecasting is illegal. For example with STRICT HWND cannot be casted to HDC, without STRICT all handles are declared as integers and hence the same type.

STRICT is there to ease debugging as illegal typecasting is found at compile time and not runtime. So yes it is a good idea to define it before including windows.h, but not necessary.
Hi.
sup?

here is some little Answer to your 4 qustion:
to compile Directx program u need first include the Directx
LIB files.
how to do it?
1.in VC++6 (in the menu) go to Project->Settings
2.in the "project settings" window choose from the combo box options the option " All Configuration"
3.then in the right side of the windows click on "Link"
4.then in the "Object/Libery Modules" text box insert with spaces: "ddraw.lib" "dxguid.lib"

done.

thats what u need to do to compile DirectDraw program.

This topic is closed to new replies.

Advertisement