Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Phidget eventhandler undefined reference 'linker'
    primarykey
    data
    text
    <p>I am getting the following errors. Based on the last line I believe it a linker error. However, I really don't know what I am talking about. :) I'm a beginner. If you happen to spot any other crappy points please let me know!</p> <p>error: undefined reference to <code>AttachHandler(_CPhidget*, void*)' error: undefined reference to</code>DetachHandler(_CPhidget*, void*)' error: undefined reference to <code>ErrorHandler(_CPhidget*, void*, int, char const*)' error: undefined reference to</code>Data(_CPhidgetBridge*, void*, int, double)' :-1: error: collect2: ld returned 1 exit status</p> <p>I have a header file named eventhandlers.h that contains: </p> <pre><code>#ifndef EVENTHANDLERS_H #define EVENTHANDLERS_H #include &lt;phidget21.h&gt; int CCONV AttachHandler(CPhidgetHandle SENSOR, void *userptr); int CCONV DetachHandler(CPhidgetHandle SENSOR, void *userptr); int CCONV ErrorHandler(CPhidgetHandle SENSOR, void *userptr, int ErrorCode, const char *DESCR); int CCONV Data(CPhidgetBridgeHandle SENSOR, void *userptr, int index, double val); #endif // EVENTHANDLERS_H </code></pre> <p>I am trying to pass the AttachHandler, and others as a parameter of CPhidget_Set_OnAttach_Handler() in a source file name quadbridge.cpp <em>PARTIAL CODE</em>:</p> <pre><code>#include "stdlib.h" #include "quadbridge.h" #include "eventhandlers.h" QuadBridge::QuadBridge(int numOfSensors, int PhidgetID) { this-&gt;SERIAL = 140800; //this-&gt;SERIAL = 137723; this-&gt;bridge = 0; CPhidgetBridge_create(&amp;bridge); setEventHandlers(); if(setAttachController(PhidgetID)) { getNumOfSensorsAttached(numOfSensors); initSensors(); } else { exit(1); } } QuadBridge::~QuadBridge() { CPhidget_close((CPhidgetHandle)bridge); CPhidget_delete((CPhidgetHandle)bridge); } void QuadBridge::setEventHandlers() { CPhidget_set_OnAttach_Handler((CPhidgetHandle)bridge, AttachHandler, 0); CPhidget_set_OnDetach_Handler((CPhidgetHandle)bridge, DetachHandler, 0); CPhidget_set_OnError_Handler((CPhidgetHandle)bridge, ErrorHandler, 0); CPhidgetBridge_set_OnBridgeData_Handler(bridge, Data, 0); CPhidget_open((CPhidgetHandle)bridge, SERIAL); } </code></pre> <p>And finally - I get the whole thing rolling in main.</p> <pre><code>#include "palmtools.h" #include "QuadBridge.h" #include &lt;QApplication&gt; QuadBridge *qb; int main(int argc, char *argv[]) { QApplication a(argc, argv); PalmTools w; w.show(); qb = new QuadBridge(4); return a.exec(); } </code></pre> <p>Thanks for the help!</p>
    singulars
    1. This table or related slice is empty.
    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.
    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