Secko
Secko

Reputation: 7716

Compiling code using gcc and SciTE?

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.

Upvotes: 2

Views: 8615

Answers (2)

Oli4
Oli4

Reputation: 499

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).

Upvotes: 4

Saqib Farooq
Saqib Farooq

Reputation: 11

Go to options -> cpp.properties -> goto line 303 or find the following line:

cc=g++ $(ccopts) -c $(FileNameExt) -o $(FileName).o

next line will be for gcc option.

Now set full path for gcc or g++ as follows,

ccc=D:\Dev-Cpp\bin\gcc.exe $(ccopts) -c $(FileNameExt) -o $(FileName).o

In the above line D:\Dev-Cpp\bin\gcc.exe is the path for gcc on my system. You can do the similar thing by editing the path according to your own installation of gcc. Once set write a program and compile.

Note: There are other options for you to set for example the standard to use for compiling your programs.

I hope it helps.

Upvotes: 1

Related Questions