1

I seem to be at a dead end here. I cannot change the terminal for Code::Blocks on Windows, although it is a cakewalk in Linux.

  1. The option is greyed out.
  2. Running as admin doesn't work also.
  3. The box has command bin/sh -c inside. I installed ConEmu and made it the default terminal for all applications. I found a sh.exe in MinGW/bin/mysys/1.0/ , and opening it runs the ConEmu terminal, and I couldn't find any other file named 'sh' (I also have bash installed in Windows through git). So running sh.exe runs bash in ConEmu.

I searched a lot, but it doesn't seem that anybody's query was fulfilled. How do I change my terminal from the infernal Windows cmd in Code::Blocks?

rzickler
  • 216
goelakash
  • 135

3 Answers3

1

Almost all words from your question may be trimmed.

So, if your question was in fact "How to set up ConEmu as default terminal for Code::Blocks" you may easily find the answer in docs. Just specify proper names as hooked executables

codeblocks.exe|gdb.exe

You have problems because Code::Blocks is trying to execute the following:

C:\Program Files (x86)\CodeBlocks\cb_console_runner.exe "C:\Users\Akash\Google Drive\Codes\codeforces\H_designation.exe"

Do they know that paths with special symbols like spaces must be put in double quotes? Reinstall Code::Blocks in the folder without spaces, or run Code::Blocks using short names, sort of

C:\PROGRA~2\CodeBlocks\codeblocks.exe
rzickler
  • 216
Maximus
  • 20,835
0

Don't change any Code::Blocks settings. Its just the terminal window you want to adjust.
All you need to do is:

  1. Run your code in Code::Blocks to activate the window

  2. Then right click on the menu bar to get a menu.

  3. Go to properties

  4. Adjust both the width and height in your screen buffer size and window size I chose 300x100 for the first one and I think i got a default for the other.

  5. Hit ok and the console screen will resize itself.

rzickler
  • 216
0

I am using cmder. Make it as default terminal emulator (from its settings).

Since Code::Blocks does not execute the console directly but by using its own programm cb_console_runner.exe located in Code::Blocks installation directory. Therefore your console application is not getting hooked by ConEmu or Cmder.

!!TRY THIS ONLY IF YOU KNOW WHAT YOU ARE DOING!!

Its a kind of hack. Lets replace the Code::Blocks cb_console_runner.exe with our own-built.

Follow these steps:

  1. Open Code::Blocks and open a new project or a new file

  2. Copy and paste this small program and save it as C file (*.c)

     #include<stdio.h>
     int main(int argc, char *argv[])
     {
         int retval;
         if (argc>1)
         {
             retval=system(argv[1]);
             printf("\n\nProgram ended with exit status: %d\n\n", retval);
             system("pause");
             return retval;
         }
         else
         {
             printf("Provide a executable path as command line arg");
             return 1;
         }
     }
    
  3. Compile this project or file to obtain its executable file (.exe)

  4. Rename this new executable file name cb_console_runner.exe and copy it.

  5. Open Code::Blocks installation directory in witch the original cb_console_runner.exe file is located.

  6. Rename the orginal cb_console_runner.exe file to some other name so you can restore it later if required.

  7. Paste your own built cb_console_runner.exe file into the folder.

Now open Code::Blocks and test it with a sample program.

rzickler
  • 216
prodev
  • 101