Note that there are some explanatory texts on larger screens.

plurals
  1. POC++/CLI application for InjectTouchInput API. LNK2028 and LNK2019 errors
    primarykey
    data
    text
    <p>I'm trying to build a C++/CLI library in Visual Studio 2012 (on Win8 Release Preview) to use the functions <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/hh802880%28v=vs.85%29.aspx" rel="nofollow">InitializeTouchInjection</a> and <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/hh802881%28v=vs.85%29.aspx" rel="nofollow">InjectTouchInput</a> in C#.</p> <p>I define my class like so</p> <pre><code>// MultiTouchWrapper.h namespace MultiTouchWrapper { public ref class MultiTouchInjection { public: static bool InitializeMultiTouch(int maxCount); static bool InjectMultiTouch(int count, float *x, float *y, int *id); }; } </code></pre> <p>and implement the functions</p> <pre><code>//MultiTouchWrapper.cpp #include "stdafx.h" #include "MultiTouchWrapper.h" namespace MultiTouchWrapper{ bool MultiTouchInjection::InitializeMultiTouch(int maxCount){ if(InitializeTouchInjection(maxCount, TOUCH_FEEDBACK_DEFAULT)) return true; return false; } bool MultiTouchInjection::InjectMultiTouch(int count, float *x, float *y, int *id){ POINTER_TOUCH_INFO *contacts = new POINTER_TOUCH_INFO[count]; for(int i=0; i&lt;count; i++){ contacts[i].pointerInfo.pointerType = PT_TOUCH; contacts[i].pointerInfo.pointerId = id[0]; contacts[i].pointerInfo.ptPixelLocation.y = (LONG)y[0]; contacts[i].pointerInfo.ptPixelLocation.x = (LONG)x[0]; contacts[i].touchFlags = TOUCH_FLAG_NONE; contacts[i].touchMask = TOUCH_MASK_NONE; } if(InjectTouchInput(count, contacts)) return true; //defined like this to avoid a warning about BOOL vs bool. return false; } </code></pre> <p>In stdafx.h I include <code>&lt;windows.h&gt;</code>, which gives the definition of <code>InitializeTouchInjection</code> and <code>InjectTouchInput</code> through <code>&lt;WinUser.h&gt;</code>.</p> <p>The problem I'm running across is that when I try to build this library, I get the errors LNK2028 and LNK2019 for both functions:</p> <pre><code>Error 1 error LNK2028: unresolved token (0A00003B) "extern "C" int __stdcall InjectTouchInput(unsigned int,struct tagPOINTER_TOUCH_INFO const *)" (?InjectTouchInput@@$$J18YGHIPBUtagPOINTER_TOUCH_INFO@@@Z) referenced in function "public: static bool __clrcall MultiTouchWrapper::MultiTouchInjection::InjectMultiTouch(int,float *,float *,int *)" (?InjectMultiTouch@MultiTouchInjection@MultiTouchWrapper@@$$FSM_NHPAM0PAH@Z) C:\Users\mediascape\documents\visual studio 2012\Projects\MultiTouchWrapper\MultiTouchWrapper\MultiTouchWrapper.obj MultiTouchWrapper Error 2 error LNK2028: unresolved token (0A000063) "extern "C" int __stdcall InitializeTouchInjection(unsigned int,unsigned long)" (?InitializeTouchInjection@@$$J18YGHIK@Z) referenced in function "public: static bool __clrcall MultiTouchWrapper::MultiTouchInjection::InitializeMultiTouch(int)" (?InitializeMultiTouch@MultiTouchInjection@MultiTouchWrapper@@$$FSM_NH@Z) C:\Users\mediascape\documents\visual studio 2012\Projects\MultiTouchWrapper\MultiTouchWrapper\MultiTouchWrapper.obj MultiTouchWrapper Error 3 error LNK2019: unresolved external symbol "extern "C" int __stdcall InitializeTouchInjection(unsigned int,unsigned long)" (?InitializeTouchInjection@@$$J18YGHIK@Z) referenced in function "public: static bool __clrcall MultiTouchWrapper::MultiTouchInjection::InitializeMultiTouch(int)" (?InitializeMultiTouch@MultiTouchInjection@MultiTouchWrapper@@$$FSM_NH@Z) C:\Users\mediascape\documents\visual studio 2012\Projects\MultiTouchWrapper\MultiTouchWrapper\MultiTouchWrapper.obj MultiTouchWrapper Error 4 error LNK2019: unresolved external symbol "extern "C" int __stdcall InjectTouchInput(unsigned int,struct tagPOINTER_TOUCH_INFO const *)" (?InjectTouchInput@@$$J18YGHIPBUtagPOINTER_TOUCH_INFO@@@Z) referenced in function "public: static bool __clrcall MultiTouchWrapper::MultiTouchInjection::InjectMultiTouch(int,float *,float *,int *)" (?InjectMultiTouch@MultiTouchInjection@MultiTouchWrapper@@$$FSM_NHPAM0PAH@Z) C:\Users\mediascape\documents\visual studio 2012\Projects\MultiTouchWrapper\MultiTouchWrapper\MultiTouchWrapper.obj MultiTouchWrapper </code></pre> <p>I'm not sure what to do. I've tried including /LD in the Configuration Properties >> C/C++ >> Command Line menu. I've tried changing the calling convention to <code>__cdecl</code> in the Advanced menu, but it always reverts back to <code>__stdcall</code>.</p> <p>Any help on what to do to get around these linker errors?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload