codeforces uses this command to compile C++ Codes g++ -Wall -Wextra -Wconversion -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++20 <source>
. When I am using this command on my Macbook Air M1, it's giving me the error unknown option: --stack=268435456
. Can anyone tell me how do I increase the stack size for c++ codes during compilation on a Macbook, I am using gcc-homebrew 11.2.0
My compilation code is g++ -Wconversion -Davik_local -Wl,--stack=268435456 -O2 -std=c++20
Thank You!
This command which you are mentioning is for windows systems, for linux based systems use
ulimit -s unlimited
. This gives unlimited stack size but if you want limited ones like 256 MB then use the commandulimit -s <size in kb>
.now when I am using this command
g++ -Wconversion -Davik_local ulimit -s <268435456> -O2 -std=c++20
its giving me error :syntax error near unexpected token
268435456'` ,You dont use it like that!
In the shell first use
ulimit -s unlimited
and then
g++ -Wconversion -Davik_local -O2 -std=c++20