ALT__'s blog

By ALT__, history, 3 months ago, In English

Sorry if this is not the right place to post this but I tried lots of different thing but just couldn't get it to work. I can write a normal code and compile it with no input. But it just doesn't work with inputs, I tried bunch of different build system but nothing worked. How do I fix this? Or if you don't use sublime, then what do you use on mac? thanks.

 
 
 
 
  • Vote: I like it
  • +1
  • Vote: I do not like it

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

Drag your main file to commander compiles it, then type ./a.out , You can cin and cout with commander.

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

If you are using C++

this build system works for me https://ideone.com/wgbhAX

for input & output: I use an input and output files and I add this piece of code in the beginning of my main function

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
  • »
    »
    3 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thanks brother it worked for me just fine build system and everything but by default m1 Macs uses clang gcc and g++ compilers does it cause any problem in long run?

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

      It does cause problems, eg. When you're using policy based data structures like order statistics trees etc.

      Try brew install gcc

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

If you Know Hindi You can Refer to this Video(It was really helpful to me) — https://www.youtube.com/watch?v=Zlx7gmt3lBU&t=656s Otherwise Refer to this Video — https://www.youtube.com/watch?v=Fql_b-xZYwQ

The Only changes That You have Have to make in the first video is in build system you have to change g++-10 to your gcc version(mine was g++-11).

If you still have some doubts you can always Join Sublime's official Discord server or The discord server of The guy in first video.

If You Found This Blog helpful consider Upvoting :)

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

    Idk this doesn't work for me. Are you using M1 mac? Guess I'll stick to using sublime for compiling and terminal for executing.

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

This plugin works for me.

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

You can compile your program with mac terminal command line interface(cli), right? If that is true then simply install a sublime package known as "Terminus", it will allow you to run you terminal shell in sublime itself.

Just download that package & then press, command+shift+P, then a search bar will appear just type terminus -> List Shells -> Login Shell -> Open in Tab/Open in Panel.

So this will open your terminal cli in Sublime console, or into another tab itself. You can message me if facing any problem.