FastOlympicCoding
FastOlympicCoding copied to clipboard
How to use c++17 in CppFastOlympicCoding package?
Hi Jatana! I want to use c++17 in cppfastolympiccoding. please help me.
Hello! To use C++17, please do the following:
- Go to
Tools
->[Cpp]FastOlympicCoding
->settings
- Copy all settings from the default file (on the left) to the user file (on the right)
- Replace all instances of
-std=gnu++11
with-std=gnu++17
@npanuhin How can I move the test files to a different directory? I want to change the directory of generating the test files.
@j0k4rX, you can use the tests_relative_dir
setting to change the relative path to the directory containing the tests. You can also use the tests_file_suffix
setting to change the default :tests
suffix for test files (which causes problems on Windows).
For example (FastOlympicCoding.sublime-settings
):
"tests_relative_dir": "my_tests",
"tests_file_suffix": ".tests"
will result in:
@npanuhin thanks for the quick reply! But it is not working for me. Still, the file is being saved in the current directory. I am on Linux, using sublime-text 4
Alright, I found out where the problem was: these features were added after 1.4.10
release. Pinging @Jatana to update the package :)
If you do not want to wait, you can use the master
branch of this repository:
- Remove the package
-
Package Control: Add Repository
-> enterhttps://github.com/Jatana/FastOlympicCoding
- Install the
FastOlympicCoding
package as usual, but pay attention to the version, it should bev2020.11.13...
@npanuhin Thank you so much! It worked!
Glad to hear that. You are welcome
@npanuhin, sorry for disturbing you again. I am stuck at a point. The problem is how to increase stack size for cpp programs in the sublime text? I know these two extra commands to add but don't know how to implement them.
- for windows :
-Wl,--stack,268435456
- for Linux & mac terminal :
ulimit -s unlimited
I got this https://pastebin.com/H9cAHWRR so far.
And what does "lint_compile_cmd"
does? is this for any error detection?
@npanuhin ??
Sorry, I've been a little busy. The config, you provided - doesn't it work? What does it output?
lint_compile_cmd
is used for the Lint module of this package (I haven't used it and know nothing about it). I think this is a command to pre-run the program to check it for errors.
@npanuhin, the config that I provided, I don't know whether it is rightly configured or not. you can refer to this https://stackoverflow.com/a/64085509
In codeforces, the stack size allocated for cpp programs is much higher than a machine normally has (you can find the compilation flags here https://codeforces.com/blog/entry/57646), and again Facebook hacker cup also exceeds this memory limit.
I increased stack size in Linux (adding ulimit -s unlimited
in bashrc). But it is limited to the shell only, which has nothing to do with sublime text. For windows, it would be easier to update the compilation flag by adding this -Wl,--stack,268435456
code.
@j0k4rX If you're not sure where to put the compiler option, it's here https://github.com/Jatana/FastOlympicCoding/blob/3e058e5915ffcb2e5f9fb1673bd34945c46e0940/FastOlympicCoding%20(Linux).sublime-settings#L21
@qumusabel, thanks for the concern! But how can I increase the stack size via that compiler option? see https://github.com/Jatana/FastOlympicCoding/issues/21#issuecomment-851488563 How to implement them?
Actually, FOC will run the program in a shell: https://github.com/Jatana/FastOlympicCoding/blob/3e058e5915ffcb2e5f9fb1673bd34945c46e0940/Modules/ProcessManager.py#L74-L75
So you just have to add ulimit -s unlimited;
at the beginning of run_cmd
:
"run_cmd": "ulimit -s unlimited; ./\"{file_name}\" {args} -debug"
Actually, FOC will run the program in a shell:
https://github.com/Jatana/FastOlympicCoding/blob/3e058e5915ffcb2e5f9fb1673bd34945c46e0940/Modules/ProcessManager.py#L74-L75
So you just have to add
ulimit -s unlimited;
at the beginning ofrun_cmd
:"run_cmd": "ulimit -s unlimited; ./\"{file_name}\" {args} -debug"
I think the appropriate would be adding ulimit -s unlimited
in compile_cmd
.
Can you please check?
The compiler and linker are not responsible for stack allocation. It's a setting for current shell, so it must be added to run_cmd
.
Is the issue resolved?
Is the issue resolved?
can u pls explain how the class-completions work here?
i think, the modules
section & olympic_funcs.py
maintain those, right?
Actually, FOC will run the program in a shell:
https://github.com/Jatana/FastOlympicCoding/blob/3e058e5915ffcb2e5f9fb1673bd34945c46e0940/Modules/ProcessManager.py#L74-L75
So you just have to add
ulimit -s unlimited;
at the beginning ofrun_cmd
:"run_cmd": "ulimit -s unlimited; ./\"{file_name}\" {args} -debug"
And in windows? should i allocate stack in compile time?
Actually, FOC will run the program in a shell:
https://github.com/Jatana/FastOlympicCoding/blob/3e058e5915ffcb2e5f9fb1673bd34945c46e0940/Modules/ProcessManager.py#L74-L75
So you just have to add
ulimit -s unlimited;
at the beginning ofrun_cmd
:"run_cmd": "ulimit -s unlimited; ./\"{file_name}\" {args} -debug"
i am getting this error in m1 mac. "/bin/sh: line 0: ulimit: stack size: cannot modify limit: Operation not permitted" when using "ulimit -s unlimited"