Solved

fatal error LNK1120: 1 unresolved externals

Posted on 2002-05-28
4
6,282 Views
Last Modified: 2013-11-20
This should be an easy question.

I'm using C++6.0 and DirectX 7.0 with the SDK.

I'm trying to do this:
hRet = DirectDrawCreate(NULL, &pDD, NULL);

and then compile.
I get the following error:
--------------------Configuration: Project - Win32 Debug--------------------
Linking...
ProjectView.obj : error LNK2001: unresolved external symbol _DirectDrawCreate@12
Debug/Project.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

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

What do I do about this? I have found a question with a similer problem and it said that I press alt-f7 and enter some information. I do not however, have this information.

Thanks for the help!
0
Comment
Question by:xersoft
  • 2
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
fl0yd earned 50 total points
ID: 7040513
Project->Settings->Link: ddraw.lib guids.lib
0
 
LVL 5

Author Comment

by:xersoft
ID: 7040569
That did change the error message somewhat. Heres what I got now.

--------------------Configuration: Project - Win32 Debug--------------------
Compiling...
ProjectView.cpp
Linking...
ProjectView.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw4
Debug/Project.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Creating browse info file...

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

anyideas on this one? And what exactly am I doing in the project settings? Is there away to just make C++ find the stuff it needs when it needs it so I don't have to do this for each project?
0
 
LVL 5

Author Comment

by:xersoft
ID: 7040575
hmmmm looks like the bad line was
hRet = pDD->QueryInterface(IID_IDirectDraw4, (LPVOID *) & lpDD);

and I don't know what it does, I commented it out and it seems to compile fine. I guess you did answer the question that I asked, Thanks for the help.
0
 
LVL 8

Expert Comment

by:fl0yd
ID: 7040675
The line of code
hRet = pDD->QueryInterface(IID_IDirectDraw4, (LPVOID *) & lpDD);
asks your currently retrieved direct draw interface pointer (pDD) whether it also exposes an IDirectDraw4-interface. If so, it is created and a pointer to it is stored in lpDD. In that case hRet is greater than 0, otherwise it is below 0 - you can use
if( SUCCEEDED( hRet ) ) ... or
if( FAILED( hRet ) ) ...
to check for success/failure. I'm not at my machine right now, so I don't have access to DX7-documentation. As far as I know the refiid for direct draw in dx7 is IID_IDirectDraw7 so you shouldn't try to query for v4, unless there is a reason to do so.
The reason for the linker error is that my last post was partially wrong: replace 'guids.lib' by 'dxguid.lib' and you should be fine. Sorry about that...
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question