CPhidgetTextLCD_setScreenSize is out of scope?

C, C++, and Visual C++
mcoates
Phidgetsian
Posts: 7
Joined: Tue Jan 17, 2012 1:15 pm
Contact:

CPhidgetTextLCD_setScreenSize is out of scope?

Postby mcoates » Wed Feb 01, 2012 12:32 pm

Hi,

I seem to have a strange C++ issue. I use CPhidgetTextLCD_setScreenSize( TEXT_LCD, 7 ); to set the screensize of my lcd but whenever I compile I receive an error stating it was not declared in this scope. This is strange because any and all other CPhidgetTextLCD calls are fine and compile with no troubles. I include phidget21.h and use the -lphidget21 when compiling. Any ideas why this happens?

User avatar
Patrick
Lead Developer
Posts: 3100
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: CPhidgetTextLCD_setScreenSize is out of scope?

Postby Patrick » Wed Feb 01, 2012 1:03 pm

What if you use the 'PHIDGET_TEXTLCD_SCREEN_2x20' enum instead of '7'?

Can you confirm that 'CPhidgetTextLCD_setScreenSize' is actually declared in phidget21.h?

-Patrick

mcoates
Phidgetsian
Posts: 7
Joined: Tue Jan 17, 2012 1:15 pm
Contact:

Re: CPhidgetTextLCD_setScreenSize is out of scope?

Postby mcoates » Wed Feb 01, 2012 1:45 pm

I can compile it using the same declaration in other programs I've written. Looking in phidget21.h I see the prototype at line 688. I will attempt using the enum, but I couldn't get it to fully work that way before and used 7 instead.

mcoates
Phidgetsian
Posts: 7
Joined: Tue Jan 17, 2012 1:15 pm
Contact:

Re: CPhidgetTextLCD_setScreenSize is out of scope?

Postby mcoates » Wed Feb 01, 2012 2:11 pm

That did not work. If it helps, here is the error plus code snippet:

Code: Select all

LCD.cpp:81: error: ‘CPhidgetTextLCD_setScreenSize’ was not declared in this scope
make[3]: *** [CMakeFiles/LCD.dir/src/LCD.o] Error 1


Code: Select all

CPhidgetTextLCDHandle txt_lcd = 0;                                                                                           

  ros::init(argc, argv, "listener");
  CPhidget_enableLogging(PHIDGET_LOG_VERBOSE, NULL);

  ros::NodeHandle n;
  CPhidgetTextLCD_create(&txt_lcd);

  CPhidget_set_OnAttach_Handler((CPhidgetHandle)txt_lcd, AttachHandler, NULL);
  CPhidget_set_OnDetach_Handler((CPhidgetHandle)txt_lcd, DetachHandler, NULL);
  CPhidget_set_OnError_Handler((CPhidgetHandle)txt_lcd, ErrorHandler, NULL);

  CPhidget_open((CPhidgetHandle)txt_lcd, -1);

  if((err = CPhidget_waitForAttachment((CPhidgetHandle)txt_lcd, 0)) != EPHIDGET_OK ) {
    const char *errStr;
    CPhidget_getErrorDescription(err, &errStr);
    printf("Error waiting for attachment: (%d): %s\n",err,errStr);
    return 1;
  }

  CPhidgetTextLCD_setScreenSize(txt_lcd, 7);
  CPhidgetTextLCD_setBacklight( txt_lcd, PTRUE );
  CPhidgetTextLCD_setContrast (txt_lcd, 180);
  CPhidgetTextLCD_setBrightness( txt_lcd, 200 );

mcoates
Phidgetsian
Posts: 7
Joined: Tue Jan 17, 2012 1:15 pm
Contact:

Re: CPhidgetTextLCD_setScreenSize is out of scope?

Postby mcoates » Wed Feb 01, 2012 2:20 pm

This can be closed. I reinstalled the phidget library and compile is okay (now I must use the enum rather than an integer). Assuming this works then all is well :)


Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 1 guest