Click here to Skip to main content
14,774,396 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am new to c++ so please bear with me.

I am building some c++ that uses included headers (dshow.h) but when linking I get unresolved externals on IID and CLSID I use.

What I have tried:

I can cheat by looking into the included files and creating my own guids.h file eg:
extern "C"
	extern const IID IID_IDvdGraphBuilder =
	{ 0xFCC152B6, 0xF372, 0x11d0,
	{ 0x8E, 0x00, 0x00, 0xC0, 0x4F, 0xD7, 0xC0, 0x8B } };

	extern const CLSID CLSID_DvdGraphBuilder =
	{ 0xFCC152B7, 0xF372, 0x11d0,
	{ 0x8E, 0x00, 0x00, 0xC0, 0x4F, 0xD7, 0xC0, 0x8B } };

This works but this is not good for the long term, what am I missing?
Updated 6-Jul-18 3:26am
RedDk 5-Jul-18 14:07pm
Not sure why anyone would be hacking into a freely available code base to a 3D graphics platform (Microsoft DirectX is distributed as an SDK for numerous species of ... MS sub-platforms) but I'll assume you're using Visual Studio when doing this IID and CLSID trick ... go to Properties Page, and under Linker/Command Line type in the characters: /VERBOSE

This'll tell the linker to blow up the message content in the OUTPUT window the next time you try to compile. You ARE linking this so anyway ... the library to which the unresolved external is TRYING to link will be named now. Once you have the name ... say DXSHOW.lib or some such thing, you can go back and add it to the External Libraries list ...

Something like that. Been a while since I did DxSDK sample compiles tbh ...

You are working on a COM project which isnt easy at all. Take some time and learn from a good COM tutorials.

It is correct to define these values, but be sure that they are unique because the are the identifiers for creating instances of these classes.

Always remember: if errors occurs check the first non-null return code (HRESULT) for the reason.

Like a "House of cards" lots of things can go wrong ;-)
benjaminemanuel13 5-Jul-18 12:30pm
Thanks, the values I've used are actually the IID and CLSID values from dshow.h and strmif.h (included in dshow.h) and they work with the code I've written. I just wanted to know if I was missing something in regard the unresolved externals that pop up at link time that I've "hacked" to work.
dshow.h is from DirectShow[^], which is included in the Windows SDK.
benjaminemanuel13 5-Jul-18 12:31pm
Thanks for your reply, are there any .lib files that I should be referencing to rid me of the unresolved externals that I have to "hack" to fix?
I solved it adding:

#pragma comment(lib, "strmiids.lib")

I am surprised the lib file isn't included in the Microsoft documentation.

Thanks to all who replied.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900