Question

I want to build Free Pascal with Sublime Text 3. I always get an encoding error (see below). I also tried to save the file with encoding.

I created a sublime-build file:

{
    "cmd":["fpc $file & ${file_path}/${file_base_name}.exe"],
    "shell" : true,
}

My test program is a simple hello world:

Program HelloWorld;
begin
  writeln("Hello, world!");
  readln;
end.

My Error-Code:

[Decode error - output not utf-8]
[Finished in 0.0s with exit code 1]
[cmd: ['fpc C:\\Users\\korndi\\Documents\\FREI\\hellop.p & C:\\Users\\korndi\\Documents\\FREI/hellop.exe']]
[dir: C:\Users\korndi\Documents\FREI]
[path: C:\Python33\;;C:\FPC\2.6.2\bin\i386-Win32]
Was it helpful?

Solution

This worked for me.
CtrlB will build your file
CtrlShiftB will run it (in external cmd!!, Aww yiss!)

{
    "cmd": ["fpc", "${file_path}/${file_base_name}"],
    "selector": "source.pascal",
    "variants": [
        {
            "cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
            "name": "Run",
            "shell": true
        }
    ]
}

OTHER TIPS

I've made a build system based on Qwerty's one. When you press Ctrl-B it automatically compiles AND runs your program. Also you have 2 old vars. Basic Pascal one os renamed to Pascal - Compile

{
        "shell": true,
        "cmd": ["fpc", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "$file_base_name.exe", "&", "pause"],
        "selector": "source.pascal",
        "variants": [
            {
                "cmd": ["start", "cmd", "/c", "$file_base_name.exe & pause"],
                "name": "Run",
                "shell": true
            },
            {
                "cmd": ["fpc", "${file_path}/${file_base_name}"],
                "name": "Compile",
                "shell": true
            }
        ]
    }

If you dont need to enter data while program execution you can try this one:

{
    "cmd": ["fpc", "${file_name}", "&&", "${file_base_name}", "&&", "echo."],
    "shell": true
}

echo. prints a new line.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top