Codeblocks and sudo gcc


I am working with my son to use CodeBlocks running on the BrickPi/CINCH to compile various _test.c files such as :

I have three inter-related questions: 1) why use sudo gcc is the first place? This seems to expose various important risks that should usually be avoided.

  1. If sudo gcc is needed, then how can this be done within codeblocks IDE? Yes, I could run codeblocks IDE as sudo, but again, this seems injudicious.

  2. Lastly, a “lazy” question … I assume that are ways to implement -l and -L compilation options somewhere in CodeBlocks. I haven’t looked yet.




Hello Rob

I have no experience with CodeBlocks but I suspect sudo is necessary because the BrickPi folder belongs to root. If you do a chown pi:pi on it and all the files under it (at least those that you need), it’s possible that the need for sudo would go away.