Advertisement

Need help with libs!!!

Started by August 11, 2002 07:47 AM
9 comments, last by flukus 22 years, 4 months ago
OK. I know theres probably a very simple step that I''m missing but I don''t have a clue what it is. I''m getting this link error: chap2.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7 I''ve tried putting the ddraw.lib and ddraw.h in the directory and inluded them through Project -> add to project. I''ve got #include <ddraw.h> at the top of the page. I''ve tried the rebuild all option that worked last time I had a similar area. So who here wants to make me look stupid and point out what I did wrong?
im confused, did u include ddraw.lib thru project->add to project, cause that seems wrong, ur supposed to go to project-> settings->link and then include the lib

,Matt

-= kill one your a murderer, kill thousands your a conquerer =-
-= kill one you're a murderer, kill thousands you're a conquerer =-
Advertisement
Project -> Settings -> Link

put "ddraw.lib" at the end of the Object/Libary modules list
I''ve had FMod work fine by including the lib file using "add to project".

Anyway, I tried adding it through settings-> link and I still get the same error message!
I have a small question regarding linking libs.

I have this A.lib compiled using C calling conventions...
I dont have access to the code, only the lib file.

In my application, I use a B.lib that is compiled using C++
(a different lib which I have code access to)
That B.lib is using functions from the A.lib and I have included the lib file in the lib list in the project settings,

BUT IT STILL COMPLAINS ABOUT UNRESOLVED EXTERNALS.

B.lib is compiler using C++ notation. (.cpp files and such no /Tp or /Tc compiler options anywhere.)

Similar problems with linking was resolved by adding extern "C" to the problem libs. But in this case, I cannot recompile the A.lib since I dont have access to the code.

Is my problem due to the fact that my B.lib is compiled using C++ and the A.lib is compiled using C?

In such case, is there any way that I can force the linker to accept A.libs C notation so that the functions doesnt get unresolved?

A.lib have all the functions in it, I just cannot get the linker to understand them.

Any ideas?
I have a small question regarding linking libs.

I have this A.lib compiled using C calling conventions...
I dont have access to the code, only the lib file.

In my application, I use a B.lib that is compiled using C++
(a different lib to which I coded myself)
That B.lib is using functions from the A.lib and I have included the lib files in the lib list in the project settings,

BUT IT STILL COMPLAINS ABOUT UNRESOLVED EXTERNALS.

B.lib is compiled using C++ notation. (.cpp files and such no /Tp or /Tc compiler options anywhere.)

Similar problems with linking was resolved by adding extern "C" to the problem libs. But in this case, I cannot recompile the A.lib since I dont have access to the code.

Is my problem due to the fact that my B.lib is compiled using C++ and the A.lib is compiled using C?

In such case, is there any way that I can force the linker to accept A.libs C notation so that the functions doesnt get unresolved?

A.lib have all the functions in it, I just cannot get the linker to understand them.

Any ideas?
Advertisement
Make sure the function definitions for the plain C functions are wrapped in extern "C" when used in a .cpp file. Like this...

// In B.cpp
extern "C"
{
#include "A.h"
}

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Changed around alittle.

In my B.lib I put all includes in a B.h and added

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <malloc.h>
#include "B.h"
#include "B_extra.h"
#include "A.h"
#include "something.h"

#ifdef __cplusplus
}
#endif

... and now Im still getting unresolved externals from A.lib.
The strange part is that now its some other functions in A.lib that is unresolved.

Im quite sure about that the compiler mismatch C++ and C linkage somehow. Because all my other problems due to this was resolved by simply adding extern "C" in the problem libs.
However, with A.lib this is not an option.

/Desperate.




Flukus:

Try linking with dxguid.lib too, i.e. Project->Settings->Link

Or "#define INITGUID" before including ddraw.h

That should do it.

- Calvin
"Or "#define INITGUID" before including ddraw.h"

Ahh, that works perfectly, thanks!

This topic is closed to new replies.

Advertisement