gagantheroyal's blog

By gagantheroyal, history, 9 years ago, In English

I am new to using Far Manager (http://www.farmanager.com/). I found it very helpful for managing files and editing. But when it comes to compiling and running programs I think we have to do many things manually similar to as while running programs from command line (as compared to using suitable IDE). Also I could not find any good tutorial (in English) for compiling, running and debugging c/c++ programs using Far. Could any one please explain how I can do these tasks (compiling, running and debugging) easily? i.e. with very less manual efforts?

Also it would be great to get an explanation (steps) for running interactive programs (having user interaction in command line for giving inputs to the program). You can also post some good links to tutorials (in English) explaining all these.

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

| Write comment?
»
9 years ago, # |
  Vote: I like it +8 Vote: I do not like it

You can create file associations in Far Manager. Go to Menu (F9) -> Commands (C) -> File associations (A), then make a new file association (Insert):

Now, when you press Enter on a file, say, e.cpp, the command g++ -O2 -Wall -Wl,--stack=268435456 e.cpp -o e.exe will be executed. If all is well, the executable file e.exe will appear. For this to work, g++ must be already in your PATH. Otherwise, provide the full path, like C:\MinGW\bin\g++ instead of just g++.

Better integration (say, compile by pressing F9 in the editor) is also possible, but a bit more work to set up.

As for debugging, personally, I use debug output for debugging contest code. Not much integration needed.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    ok , i tried this steps and it succeded but until now i can't compile or run the code , please help ?

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      You will have to be more specific. Otherwise, your "succeeded" and "can't compile" statements seem to contradict each other.

      • »
        »
        »
        »
        7 years ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it

        ok i understand , but i want to ask you about something — from your opinion what is the best competitive IDE (competitive) for C++ ? ! away from the subject of far manager

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

          Huh? Sorry, I don't follow your logic.

          Anyway, there's plenty of previous discussion on the topic. In case you still have questions, do post in a more relevant place.

  • »
    »
    6 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    Thanks for that i was using ctrl+g and manually input the compile code. I going to try this.

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

    I have g++ installed and also it is set in the path but when i open file associations in far manager there is no *.cpp file extension.what should i do?

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

      Create one. Read the first comment in the thread.

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

        I went through the first comment in the thread but iam unable to create one new association. It is not showing any options and also there are no existing file associations also.The file association table is empty.

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

          Press the Insert key on your keyboard to make a new association.

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

    As you have said that after file association process we can create any file....but how would I know which is my command link...I have tried your command but it's not working... please explain it completely please

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

      As you have said that after file association process we can create any file....

      The ability to create any file does not depend on file associations.

      but how would I know which is my command link...

      When you write in the line under "Execute command (used for Enter)", the command you wrote will activate when you press Enter on the file. Same for the other lines.

      I have tried your command but it's not working...

      Maybe you forgot to save the command? When you are done on that screen, press OK to save the new file association.

      please explain it completely please

      If the above guess doesn't work, I'm out of guesses. In that case, you may want to explain what exactly you did, and what exactly didn't work.

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

        What command I should write?...I mean which link..can I write the link as you write... And how to create a file?

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

          To create a file, press Shift+F4.

          As for the other part, there is a generic manual in Far, just press F1 and follow.

          Now, if you still need specific help, please say what specifically went wrong, down to the letter, when you followed the guide above. Based on your comment, sorry, I can't guess what is the part where you get stuck.

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

    What should I write in execute command (used for enter)...? Can I write it same as you have written

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

      If you have g++ in your path, yes you can.
      Otherwise, use the full path, like C:\MinGW\bin\g++ instead of just g++.
      The remaining part of the line may remain the same.

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

        Okay sir...sir I have tried many times to create a file but it's not showing anything...what can be the reason?... Sir please help me out... please give me complete steps to create a file from beginning of opening far manage

        • »
          »
          »
          »
          »
          5 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it
          1. Open Far Manager.
          2. Navigate to a directory where you will store the program.
          3. Press Shift+F4. (On newer laptops, Fn Lock may interfere with that, act accordingly.)
          4. Input the name of the new file.
          5. Press Enter.
          6. ...
          7. Press Save (F2). (Won't work if you don't have write permission for the current file location.)
          8. Then Quit (Esc).
          • »
            »
            »
            »
            »
            »
            5 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Thanks sir...I have created the file ..but how would I have permission to save file...?

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

              Please teach me all steps until I give input to program and get the output

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

                You know, if you have trouble saving files on your computer and setting permissions to folders, perhaps you will do better with a more intuitive environment. Far Manager assumes basic skills with command line and such. Alas, I'm not that good at teaching computer literacy remotely. Google is your better friend in this case.

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

                  I completely understand you sir... But please let me know how to compile,run and give input in far manager

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

                  OK then sir, how about a question of the form of:

                  • what you did,
                  • what you expect,
                  • what actually happened?

                  I don't want to go in circles here. Do value your and others' time. As snobby as he sounds, Eric Raymond does have a point.

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

            May I know how to use F9 to compile file in far manager?

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

              For example, you can record a keystrokes sequence and bind it to a hotkey. The process is described, for example, here.

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

Whenever there is an infinte loop the Console screen gets stuck. Is there any way to set a timeout of few seconds.

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    Try Ctrl+C-ing the program then.