Without the complete context to summarize:

#include "stdafx.h"
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <objbase.h>

    using namespace std;

    BYTE* StringToGUID(LPOLESTR szBuf)
    {
        GUID *g = (GUID *) malloc( sizeof(GUID));
        HRESULT h2 = CLSIDFromString(szBuf, g);
        return (BYTE*) g;
    }

I Get:

1>Linking...
1>XorCryt.obj : error LNK2019: unresolved external symbol __imp__CLSIDFromString@8 referenced in function "unsigned char * __cdecl StringToGUID(wchar_t*)
(?StringToGUID@@YAPAEPA_W@Z)
1>C:\Users\Grace\Documents\Visual Studio 2008\XORCRYT\XORCRYT\Debug\XorCryt.exe
: fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Grace\Documents\Visual Studio
2008\XORCRYT\XORCRYT\Debug\BuildLog.htm"
1>XorCryt - 2 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Any Ideas? - Any help... I am getting ready to give up on this and try
do the hex to binary conversions myself, But if this worked it would be
nice. What am I missing? A library reference?

According to Microsoft Forum this code is supposed to work. I will continue
to look at it but if anyone has some practical experience that might be
helpful.... I can already generate the GUIDs that I need. I need to get
GUIDs entered by the user into binary form also. This seemed to be well
documented but it was hard to find the right include file and I am not
sure that that is enough.

Thanks again folks.. I *AM* learning... albeit slowly.

1>Linking...
1>XorCryt.obj : error LNK2019: unresolved external symbol __imp__CLSIDFromString@8

...it was hard to find the right include file and I am not sure that that is enough.

You still need to look up the necessary library (.lib), documentation CLSIDFromString function usually comes with a section titled Requirements explaining the required header/library files. In this case it is stated that you need to link to Ole32.lib .

You still need to look up the necessary library (.lib), documentation CLSIDFromString function usually comes with a section titled Requirements explaining the required header/library files. In this case it is stated that you need to link to Ole32.lib .

Thank You Mitrmkar! Compile and link are successful after adding Ole32.lib to
the dependencies in the linker input property page. This is Solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.