Compiling code using gcc and SciTE?

Secko picture Secko · Jul 10, 2009 · Viewed 7.1k times · Source

I'm trying to compile C/C++ code from an external source using SciTE. The SciTE has a built-in feature where it searches for the gcc compiler and libraries in the same folder. The problem occurs if I try to compile from SciTE externally. Compiling with F5 (compile and run) or CTRL-F7 (compile) results in SciTE not being able to find the compiler.

I'm wondering if there is a way (there always is) to embed the gcc compiler's path into one of SciTE's files without generally rewriting SciTE's code?

EDIT: Found a solution in Linux.

Answer

Oli4 picture Oli4 · Jun 20, 2013

I used MinGW as an external source to compile in C and C++ code in scite.

If you do not have MinGW you can get MinGW here: http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/

  • mingw may have problems if installed into directories containing spaces.

  • After installing MinGW add the bin directory to sysytem path environment variables.

    • Go to Control pannel.
    • System
    • Advanced system settings
    • Click on the Environment Variables tab
    • Add the MinGW's bin directory to the path system variables list.
    • Default directory: "C:\MinGW\bin"

In scite:

  • Open cpp.properties
  • Search for: cc=g++ $(ccopts) -c $(FileNameExt) -o $(FileName).o
  • Change the g++ part to MinGW's bin directory plus compiler exe ex:
    • cc=C:\MinGW\bin\g++.exe $(ccopts) -c $(FileNameExt) -o $(FileName).o
  • For gcc compiling change ccc=gcc.exe $(ccopts) -c $(FileNameExt) -o $(FileName).o to ccc=C:\MinGW\bin\gcc $(ccopts) -c $(FileNameExt) -o $(FileName).o
  • Now search for command.go.$(file.patterns.cplusplus)=./$(FileName)
  • Change it to command.go.$(file.patterns.cplusplus)=$(FileName).exe
  • For gcc compiling search for command.go.*.c=./$(FileName) and change it similarly.
  • Save the changes to file

Please note that you may have to change permissions in the scite folder before you will be able to save the changes to cpp.properties

Your code will now be able to compile (use shift+F7) and run(F5).