0

I have a problem when I click run it shows this error

wiringPiSetup: Must be root (Did you forget sudo ?)

I also try to write this on terminal sudo qtcreator to open the qtcreator as sudo but also the problem still thesame with thesame error

actually , I'm using raspberry pi 2 with raspbian jessie operating system

can any one here solve it to me please

  • What did you actually do? Did you follow the follow the instructions on wiringpi.com/download-and-install ? Finally why are you trying to install it - it should already be in Raspbian Jessie? – Milliways Aug 30 '16 at 4:18
  • Yes I follow this instructions – mamdouh abdelfatah Aug 30 '16 at 4:20
  • Have you looked up root and sudo? Do you understand what the error message is telling you to do? – joan Aug 30 '16 at 8:38
1

If you are using netbeans use the below steps.

  1. Open the properties of your project
  2. Select "Run"
  3. Select "Manage Platforms..."
  4. Select the Remote Java SE platform you created
  5. In the "Platform Properties" section, click the field next to "Exec Prefix"
  6. Type in "sudo" (without the double quotes)
  7. Optionally test again the platform
  8. Close the dialogue box

If you are using eclipse then try the link https://stackoverflow.com/questions/2580279/how-do-i-run-my-application-as-superuser-from-eclipse

You should have an idea now on what the issue is. If you are using some other IDE to run your program then you should look to configure like the steps mentioned for the above IDE's

Also check the post https://www.raspberrypi.org/forums/viewtopic.php?t=33881 There was a similar question posted for qtcreator. Check the git link https://github.com/Pi4J/pi4j/issues/69

  • How did you determine he is using an IDE? Especially given this: "I also try to write this on terminal sudo qtcreator" – Steve Robillard Aug 30 '16 at 6:13
  • He tells " when I click run i" , that's what made me think he is using an IDE, the very first line – Varad A G Aug 30 '16 at 6:14
  • I'm using qtcreator not netbeans nor eclipse – mamdouh abdelfatah Sep 2 '16 at 15:07
1

Add this to your code before calling wiringPiSetup():

   setenv("WIRINGPI_GPIOMEM", "1", 1);
  • interesting. I've wrapped wiringPi in Perl and somehow I'd never come across this feature. wiringPi GPIOMEM. – stevieb Oct 7 '16 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.