MarkHaysHarris777 wrote:cdbean04 wrote:Hi,
I am trying to use wiringPi to get and LED to light (just to learn how to get everything talking) from an interface using Qt while using C++. I keep getting undefined reference to anything wiringPi i try to use. ex undefined reference to 'wiringPiSetup'
I have wiringPi.h in my include list and have wiringPi.h actually added to my project with my other .h files and nothing is working. Any help would be greatly apprecited.
An undefined reference is often a path problem. It cannot find a library, or the library is missing, or you spelled something wrong, or your path variable got clobbered, or some such.
Please minimize your code to just the wiringPI (get QT out of there) and then post your error messages... look over your source carefully for misspelled words, etc.
Here is my code it is basically straight from the wiringPi site. Was just trying to get something going to test wiringPi out.
int pin;
int l;
if(wiringPiSetup() == -1)
exit(1);
for (pin = 0 ; pin < 8 ; ++ pin)
{
pinMode (pin, OUTPUT);
digitalWrite(pin,LOW);
}
pinMode (1, PWM_OUTPUT);
for(;;)
{
for (l = 0 ; l < 1024 ; ++l);
{
pwmWrite (1,1);
delay(1);
}
for (l = 1023 ; l >= 0; --l)
{
pwmWrite(1,1);
delay (1);
}
}
return ;
The error says
/home/pi/kClone/modeselect.cpp

error: undefined reference to `wiringPiSetup'
there are several other undefined reference errors, but they all look the same, just which reference is different.