User forums > Using Code::Blocks

Raspberry Pi - latest version of CodeBlocks and use of sudo

(1/2) > >>

JorgenSandberg:
I have started using CodeBlocks as IDE on Raspberry Pi with Rasbian.

1. I have installed Code::Blocks version 17:12. Is that the latest for Raspberry Pi?

2. I am using the pigpio library. When I compile, link and run the program in Code::Blocks using the "Build and Run" button, I get an error message saying that I do not have permission to execute the initialisation of the pigpio. I shall have root permission i.e. use sudo for that. How do I set Code::Blocks to use sudo? (I have been through the manual, but did not find anything on the launch of the build program)

Regards,
JorgenSandberg

AndrewCot:
The error you are getting is a Linux permission problem and not related to C::B. I would ask on a Raspberry Pi forum for how to yuo can grant your user access to the pigpio.

JorgenSandberg:
Sorry, it is a Code::Blocks problem. Somewhere Code:Blocks issues a command to the Raspberry Pi operating system of the kind ./executable. This is somewhere within Code::Blocks. I need to change that to sudo ./executable.
It has been a question a few years ago and I was hoping, that someone had figured out how to do it. Where in Code::Blocks is hidden the command to execute a program? Can the user change that command? (It can be done in GEANY).
Regards,
Jorgen Sandberg

BlueHazzard:
Sadly the user can not modify the "Run" command at the moment.
It is on my todo list for a while now...

One solution (not the preferible one) is to run codeblocks as sudo
A other, better solution is to create a Tools menu item to run the executable:
Tools+ -> Configure tools->New
Name: Run as sudo
Command line:

--- Code: ---sudo $(TARGET_OUTPUT_FILE)
--- End code ---

this is not tested, but should work...

AndrewCot:
Suggest google "sudo chgrp gpio /sys/class/gpio/export" and start reading on how to fix your permission problem.

@BlueHazzard It's a linux permission issue with resources where the user needs to add themself into the group that has access or create group and give it access..... I have to do this when running poker machine code in a Linux development environment in order to gain access to the RTC hardware and TTYSxxx (serial ports).

Navigation

[0] Message Index

[#] Next page

Go to full version