Wednesday, October 03, 2007

SciTE, Compile and Run

Lately SciTE is becoming my favorite text editor, (VIm rules always), i find the menu options Tools->Compile,Tools -> Go useful for beginners who are new to Linux/Programming,  but i found that even though it compiles properly, it does not execute it(i.e. run  ), Why?

few minutes of digging gave me these results
First: umask for files is 022, i.e. files created by user will be read/write for the user and read only for group and others
Second: compilers will know that they are creating executables and set executable bit when they produce .o/a.out files
Third: if "." is in your path, then the executables are searched in current directory as well

Now the solution:
SciTE uses gcc -c <filename.c> -o filename.o to compile a file, and filename.o to execute, i got the error "bash - access denied", i opened a terminal and tried to execute it by myself, still an error,
why?
when we compile with -c filename.c, we ask the compiler to just compile and don't link it, i.e. it creates an object file and not executable object file, so if you run, it'll produce the access denied error message.
so open cpp properties and remove that -c option, add "./" before executable i.e. ./filename.o

Now the more interesting points:
  1. SciTE reads config files when it loads, so any change you make you'll have to restart it
  2. also all but user config files should be edited as root
Disclaimer:- i dont know the impact of removing -c option, it might be useful in large or multi file programs, so please consult your manual for exact details.

Blogged with Flock

No comments: