Trying to port windows build system to linux

103 views Asked by At

This build system is for competitive coding in c++ on sublime text in 3 column view

{
"cmd": ["g++.exe","-std=c++17", "${file}", "-o", "${file_base_name}.exe", "&&" , "./${file_base_name}.exe<inputf.in>outputf.in"],
"shell":true,
"working_dir":"$file_path",
"selector":"source.cpp"
}

edits made for the port

{
"cmd": ["g++","-std=c++17", "${file}", "-o", "${file_base_name}", "&&" , "./${file_base_name}<inputf.in>outputf.in"],
"shell":true,
"working_dir":"$file_path",
"selector":"source.cpp"
}

errors

g++: fatal error: no input files
compilation terminated.
[Finished in 0.0s with exit code 1]
[cmd: ['g++', '-std=c++17', '/home/xxx/Documents/CP/file.cpp', '-o', 'file', '&&', './file<inputf.in>outputf.in']]
[dir: /home/xxx/Documents/CP]
[path: /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl]


edits made for the port v2


{ 
"cmd": ["g++ -std=c++17 ${file} -o ${file_base_name}"," && ", "./${file_base_name}<inputf.in>outputf.in"],
"shell":true,
"working_dir":"$file_path",
}

using the new v2 build system the no input file issue is resolved and the file is complied but still there is no output in the outputf.in file

using just the command in terminal

g++ -std=c++17 file.cpp -o file && ./file<inputf.in>outputf.in

produces output in the outputf.in file

1

There are 1 answers

0
Abhinav Srivastav On
"cmd": ["g++ -std=c++17 ${file} -o ${file_base_name} && ./${file_base_name}<inputf.in>outputf.in"]

this build command seems to do the trick for me it works perfectly fine for me, i dont know why and how this works but it does.

this build file was inspired form a blog post at

https://blog.codingblocks.com/2019/setting-up-a-c-competitive-programming-environment/