Archived

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

zyst

Visual C++ linking error

Recommended Posts

Hi there, I am a newbie and trying to get that first game up and running... I have finally debugged all my code and got it all working. The program compiles with no errors or warnings.... BTW - I am using directx and WIN32(Have directx 8 installed but doing Andre Lamothe book that uses directx6) Upon building the project I get the following errors... 1. game.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw4 2. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main I have added the ddraw.lib to the following places but that does not help.... tools/options/directories/include and library paths also project/settings/link I know the compiler is having a problem finding part of directx but it baffles me it can find some but not all....*F* Any help would be much appreciated.... Thanks Glen

Share this post


Link to post
Share on other sites
If you are using Microsoft Visual C++ developement software, try this: right click on your project,go to settings,go to c++,and then to precompiled headers, and select "Automatic use of precompiled headers." Leave the "Through header" field blank. Try this to see of you can get your code linked properly with the direct x libraries. Also put your direct x header files in your visual c++ #include directory for ease of use if you have not done so, but I think you have.


Edem Attiogbe

Share this post


Link to post
Share on other sites
quote:
Original post by zyst

1. game.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw4




You need to either include the dxguid.lib in your project or do a
  
#define INITGUID

before you include anything.

quote:

2. LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main



Your project is set as a console app. There should be a project setting to make it a win32 GUI application. I am not sure where it is in VC++.




-------
Andrew

Share this post


Link to post
Share on other sites
hey guys,

Thanks for your help....

I started a new project and made sure it was WIN32 app
This fixed the _main Error....

But I tried the Project/settings/c++/precompiled headers
but it is already set to "Automatic use of Precompiled headers"

Still getting the LNK2001 Errors.....

*Frown*

Glen

Share this post


Link to post
Share on other sites
Hey guys,

Found the error.....Yahooo!!!!

I was using Directx 8 and the libraries are set up different....

I uninstalled directx 8 and installed directx 6 then included all the libraries....

directdraw4 was in another library....*shakes head*

Strange thing it is in the ddraw.h file but not in the corresponding library....Oh well

Thanks again for your help guys it got me thinking about the problem from another angle.....

Exstatic boi

Glen

Share this post


Link to post
Share on other sites