User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Qt with Wiring PI

Thu Sep 08, 2016 5:16 pm

DougieLawson wrote:
[email protected] wrote:
gauravsharma0190 wrote: in this code my gui window pop up and i am able to press the button but only 1 time only .
if i again press button ,My gui close and a message pop up says
you must only call this once per programe run.this is fatal error.

Posts: 93
Joined: Tue Oct 28, 2014 12:06 pm

Yes, it is a fatal error to call wiringPiSetup() more than once in a program. You need to move the setup call to outside your main loop.

The reason is that I'm fed-up with people emailing me telling me wiringPi is broken when they repeatedly call the setup code in a loop and their program subsequently runs out of file handles some time later...

Surely it's not beyond the realms of sensibility to set a flag when wiringPiSetup() is run that you test before doing any initialisation. Second call to wiringPiSetup() effectively becomes a NOP (with a branch to function exit, as the job's already done).
Sure (and I have done that in the next version I'll release after another round of bleating) It's still a fault on the users part though.

Gordons projects:

Posts: 1
Joined: Tue Oct 31, 2017 9:21 pm

Re: Qt with Wiring PI

Tue Feb 20, 2018 8:27 pm

bgreat wrote:
Sat Feb 16, 2013 2:23 am
You are confusing the library and include sections in the .pro file.

In your .pro:

Code: Select all

# So wiringPi include files can be found during compile
INCLUDEPATH    += /usr/local/include

# To link the wiringPi library when making the executable
LIBS += -L/usr/local/lib -lwiringPi
Hi everybody,

my problem was How to make to WiringPi "works" in my project, and it (the above answer) is "the solution" for me.


Return to “C/C++”