Jatana / FastOlympicCoding

Tools for competitive programming for Sublime Text 3 & 4
403 stars 48 forks source link

How to use c++17 in CppFastOlympicCoding package? #21

Open abmahfuz opened 4 years ago

abmahfuz commented 4 years ago

Hi Jatana! I want to use c++17 in cppfastolympiccoding. please help me.

npanuhin commented 4 years ago

Hello! To use C++17, please do the following: 1) Go to Tools -> [Cpp]FastOlympicCoding -> settings 2) Copy all settings from the default file (on the left) to the user file (on the right) 3) Replace all instances of -std=gnu++11 with -std=gnu++17

j0k4rX commented 3 years ago

@npanuhin How can I move the test files to a different directory? I want to change the directory of generating the test files.

npanuhin commented 3 years ago

@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: Снимок экрана 2021-05-29 132915

j0k4rX commented 3 years ago

@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

npanuhin commented 3 years ago

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: 1) Remove the package 2) Package Control: Add Repository -> enter https://github.com/Jatana/FastOlympicCoding 3) Install the FastOlympicCoding package as usual, but pay attention to the version, it should be v2020.11.13...

Снимок экрана 2021-05-29 152957

j0k4rX commented 3 years ago

@npanuhin Thank you so much! It worked!

npanuhin commented 3 years ago

Glad to hear that. You are welcome

j0k4rX commented 3 years ago

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

I got this https://pastebin.com/H9cAHWRR so far. And what does "lint_compile_cmd" does? is this for any error detection?

j0k4rX commented 3 years ago

@npanuhin ??

npanuhin commented 3 years ago

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.

j0k4rX commented 3 years ago

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

qumusabel commented 3 years ago

@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

j0k4rX commented 3 years ago

@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?

qumusabel commented 3 years ago

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"
j0k4rX commented 3 years ago

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"

I think the appropriate would be adding ulimit -s unlimited in compile_cmd. Can you please check?

qumusabel commented 3 years ago

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.

qumusabel commented 3 years ago

Is the issue resolved?

j0k4rX commented 2 years ago

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?

DeveloperKev commented 1 year ago

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"

And in windows? should i allocate stack in compile time?

DeveloperKev commented 1 year ago

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"

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"