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

2 Answers2

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

Varad A G
  • 850
  • 6
  • 18
1

Add this to your code before calling wiringPiSetup():

   setenv("WIRINGPI_GPIOMEM", "1", 1);
Shiro
  • 41
  • 3