How to create GUID of type... LNK2020, Error LNK 2001, Error LNK1120 in MS VS 2008 RRS feed

  • Question

  • Hello,

    how can I create GUID of IID_IDirectInput8 constant ? I get the value is :

    IID_IDirectInput8 = { 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00 };

    But I am not able to convert it to standard GUID. I need to pass it to this function

    DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&di, NULL))) {

    If I try use it directly I get Error LNK2020, Error LNK 2001, Error LNK1120.

    Many thanks

    • Moved by Yi Feng Li Friday, May 14, 2010 3:10 AM Directinput GUID (From:Visual C++ Language)
    Saturday, May 8, 2010 9:43 PM

All replies

  • I don't understand what problem you are having. You have the value of IID_IDirectInput8 in front of you. Have you not used it in your source code? Just define it as type GUID (found in rpc.h or rpcdce.h)

    If I've misunderstood you, why not post a little code and rephrase your question.


    Sunday, May 9, 2010 2:14 AM
  • Looks like duplicate of http://social.msdn.microsoft.com/Forums/en-US/gametechnologiesdirectx101/thread/d91c819d-1d55-4203-b814-6a1ede828991

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Tuesday, May 11, 2010 10:14 PM
  • Hello,

    yes it seems to be a little duplicate. But I tried to pass the GUID directly as a paramater of function.

    I found in MS header files:

    GUID of IID_IDirectInput8 is equal to { 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00 };

    But I do not know how to create from HEX sequence the right GUID. I heard there is a macro ...  somewhere...

    If I use

    IID_IDirectInput8 = { 0xBF798031,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00 };

    DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&di, NULL))) {

    but, it does not work.

    Wednesday, May 12, 2010 9:05 AM
  • I am trying:
      382    // {883940AD-AC29-4ee5-911A-F4E6B4EEBFC3}
      383    DEFINE_GUID(MyGUID, 0x883940ad, 0xac29, 0x4ee5, 0x91, 0x1a, 0xf4, 0xe6, 0xb4, 0xee, 0xbf, 0xc3);
     IID_IDirectInput8 = MyGUID;
    but I get this:
      ------ Build started: Project: ROBOMAP, Configuration: Release Win32 ------
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(380) : error C2059: syntax error : '<cv-qualifer>'
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(380) : error C2143: syntax error : missing ';' before '{'
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(380) : error C2059: syntax error : '{'
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(383) : error C2065: 'MyGUID' : undeclared identifier
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(383) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(383) : error C2078: too many initializers
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(4213) : error C2059: syntax error : '}'
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(4213) : error C2143: syntax error : missing ';' before '}'
      c:\_msvs\clrw6\robomap\robomap\View_createLSSimulation.h(4213) : error C2059: syntax error : '}'
      Build log was saved at "file://c:\_MSVS\CLRW6\ROBOMAP\ROBOMAP\Release\BuildLog.htm"
      ROBOMAP - 9 error(s), 0 warning(s)
      ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Wednesday, May 12, 2010 9:39 AM