Search code examples
raspberry-pilcdwiringpi

WiringPi's LCD Library - undefined reference to `lcdInit'


Trying to compile a very simple program for testing wiringpi's library for the hd44780 lcd controller:

#include <iostream>
#include <wiringPi.h>
#include <lcd.h>
...
int main()
  {
    init_wiringpi;
    fd = lcdInit(2, 16, 4,  11,10 , 0,1,2,3,0,0,0,0) ;
  ...
  return = 0;
  }

Build Messages
LCD_first.cpp - undefined reference to `lcdInit'  
LCD_first.cpp - undefined reference to `lcdPosition'  
LCD_first.cpp - undefined reference to `lcdPuts'  

Solution

  • Ok i just had to add lcd.o to the linked libraries list in Code::Blocks (settings/compiler/Linker settings/Link libraries >> /home/pi/wiringPi/devLib/lcd.o).