Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Linking Errors with SDK Example1!: Solved TY :)

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

Hi All- I'm having trouble linking.... Mostly I want to confirm that I can use Directx by simply running example1 that comes with the sdk. 1)Im using Dirextx 3.0 (by necessity- im on windows nt) 2)Compiler is MS Visual c++ Verion 6 professional 3)I create a win32 application using the wizard & cut and paste the ddex1.cpp code- compile & get linking errors below. 4)The readme text in the samples folder talks about doing a make for vc++- (see below) i try this but I get that the name specified (nmake retail) is unrecognized. 5)To ensure that its not a problem of not being able to find the includes, I moved all of them to the project directory. Have also tried including ddraw.h before the others- but same errors. Honestly, I have no idea whats going on...I really just want to get a little example compiled and running to prove that its feasible- my worry is that perhaps the vc++ 6.0 compiler and directx 3.0 are not compatible or that windows nt will screw things up somehow.. If you have any ideas, Id really appreciate hearing them- Thanx Partial listing ******************************** * Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved. * * File: ddex1.cpp * Content: Direct Draw example program 1. Creates a Direct Draw * object and then a primary surface with a back buffer. * Slowly flips between the primary surface and the back * buffer. Press F12 to terminate the program. * ***************************************************************************/ #define NAME "DDExample1" #define TITLE "Direct Draw Example 1" #define WIN32_LEAN_AND_MEAN // I also tried placing ddraw.h here- same errors #include "windows.h" #include "windowsx.h" #include "ddraw.h" #include "stdlib.h" #include "stdarg.h" #include "resource.h" #define TIMER_ID 1 #define TIMER_RATE 500 LPDIRECTDRAW lpDD; // DirectDraw object LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface LPDIRECTDRAWSURFACE lpDDSBack; // DirectDraw back surface BOOL Errors listing ******************************* Compiling... ddex1.cpp Linking... ddex1.obj : error LNK2001: unresolved external symbol _DirectDrawCreate@12 LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main Debug/ddex1.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. ddex1.exe - 3 error(s), 0 warning(s) Partial Instructions in the readme file ****************************************** There is a main make files each sample directory: MAKEFILE - for use with Microsoft VC++ 2.0 or higher (NMAKE) There are 2 ways to build each sample, debug or retail. To build a sample as retail with VC++, just type: nmake retail From the SAMPLES directory, you may also run the following batch files: MAKEALL.BAT - makes all examples with Microsoft VC++ Edited by - simulator on July 19, 2001 12:47:07 AM

Share this post

Link to post
Share on other sites
Ok, make sure you''re creating a Win32 Application and not a Win32 Console Application. It seems the compiler is looking for your main() function, which doesn''t exist in a Win32 Application.

Second, make sure that you''re linking to ddraw.lib. Go to Project->Settings, then click on the link tab, look down where it says "object/library modules". And in the space below it, after all the others, type in a space and ''ddraw.lib''.

I''m pretty sure those are you''re problems. If you need anymore help, feel free to post it.

"We are the music makers, and we are the dreamers of the dreams."
- Willy Wonka

Share this post

Link to post
Share on other sites
For starters, all I have are linux boxes laying around at the moment so I can''t verify this before posting it.

Be sure to include the dxguid.lib in your project as it has the necessary symbols you''ll need to link with.

I''m pretty sure you also need to make a windows application and not a console app. Your project sounds like it''s being linked against the console libs, when it should be linked against window libs, which is what happens when you try to compile something with devstudio without making a project workspace for it. i.e. compiling a source file directly, it defaults to a console build when it builds the workspace for you.


Share this post

Link to post
Share on other sites
Hi & Thanx-

It''s definitly not a console application- just a win32 application & I make a project workspace for it.

I added the ddraw.lib and its worked- it''s no longer complaining about the _DirectDrawCreate@12 but it''s still not working with the _main:

--------------------Configuration: ddex1try2 - Win32 Debug--------------------
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/ddex1try2.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

ddex1try2.exe - 2 error(s), 0 warning(s)

I added dxguid.lib & LIBCD.lib to the libray modules (same way as for ddraw.lib) just for the heck of it but still no go.

I wonder if it could be a video card problem- that''s really the only other thing that im worried about.....

Thanx :-)

Share this post

Link to post
Share on other sites
the wizard eh...That might be part of your problem. When you''re selecting your application type, just create a Win32 application and create an empty workspace for it, then create your .cpp as a new file instead of cut''n''pasting into the wizard''s code. Might not make a difference, but it''s worth a try...


Unable to register Reality...what''s wrong?
Dan Upton
Lead Designer
WolfHeart Software

Share this post

Link to post
Share on other sites
Ahaha Yahoo its working thank you!!!!
Lol, yes was doing something not quite right in adding the source so thanx to all.

so instructions are:
1)using wizard, create win 32 application
2)next screen choose "empty work space"
3)from main menu choose file-new-c++source
3)cut & paste ddex1.cpp from the sdk into empty source file
4)from main menu choose project-settings & add ddraw.lib to the list of library modules
5)build & voila

ps- no need to copy any header files to the project directory....
how the linker knows where to find ddraw.h must come from adding ddraw.lib.

Thanx again

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!