Как использовать Mingw с системой сборки в Sublime Text - PullRequest
0 голосов
/ 22 марта 2020

Я использую Sublime Text и изучаю C ++. Я установил Mingw (также добавил путь) и Sublime Text и добавил новую систему сборки для получения внешнего вывода и ввода.

Вот код:

{
    "cmd" : ["g++ -std=c++14 '$file_name' -o '$file_base_name' && timeout 4s ./'$file_base_name'<input.txt>output.txt"], 
    "selector" : "source.c, source.cpp",
    "shell": true,
    "working_dir" : "$file_path"
}

После нажатия Control + B выдает ошибку:

c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:D:\Anand\competitive programming\input.txt: file format not recognized; treating as linker script
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe:D:\Anand\competitive programming\input.txt:1: syntax error
collect2.exe: error: ld returned 1 exit status
[Finished in 0.1s with exit code 1]
[shell_cmd: g++ "D:\Anand\competitive programming\input.txt" -o "D:\Anand\competitive programming/input" && "D:\Anand\competitive programming/input"]
[dir: D:\Anand\competitive programming]
[path: C:\MinGW\bin;C:\Program Files\Java\jdk-12.0.2\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\MinGW\bin]

Error 2:

The system cannot find the path specified.
[Finished in 0.0s with exit code 1]
[cmd: ["g++ -std=c++14 'HelloWorld.cpp' -o 'HelloWorld' && timeout 4s ./'HelloWorld'<input.txt>output.txt"]]
[dir: D:\Anand\competitive programming]
[path: C:\MinGW\bin;C:\Program Files\Java\jdk-12.0.2\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\MinGW\bin]

1 Ответ

0 голосов
/ 25 марта 2020

Вам не нужны одинарные кавычки, окружающие переменные $, и вам не нужен ./, так как вы запускаете Windows. Отредактируйте свою систему сборки, включив в нее следующее:

"cmd" : ["g++ -std=c++14 $file_name -o $file_base_name && timeout 4s $file_base_name < input.txt > output.txt"],

, и все должно быть готово.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...