wraith_11's blog

By wraith_11, history, 3 years ago, In English

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!

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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 command ulimit -s <size in kb>.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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 token268435456'` ,

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You dont use it like that!

      In the shell first use
      ulimit -s unlimited
      and then
      g++ -Wconversion -Davik_local -O2 -std=c++20