In Code::Blocks can set programs arguments in IDE ("Project > Set programs' arguments...")

But in windows version, the redirection is not working.


How to make it enable?


The problem is the 'cb_console_runner.exe'.

That use CreateProcess() function to start the child process.

Unfortunately, CreateProcess() CAN'T handle redirections.

Why does 'cb_console_runner.exe' use this function?


It is written in source code.

    //Windows's system() seems to not be able to handle parentheses in
    //the path, so we have to launch the program a different way.

( See this svn log. )


So I complied the 'cb_console_runner.exe' using system() instead of CreateProcess().

In my windows7, It works well and it seems that there is no problem about parentheses.

( That was modified in 2006. Now does it fixed?. I don't know. )


Anyway I replaced the 'cb_console_runner.exe' with my own build.

If anyone having a redirection problem in windows version of Code::Blocks, try this one.

cb_console_runner.exe

(Just copy to where Code::Blocks installs and replace original file with this)


Or you can build it easely with just a few modification. (That's why I didn't attach soruce code.)

I modified and built this in Code::Block. ;)


P.S

영어로 쓰고 나니 진에 빠져서, 한글로 내용을 다시 쓰는건 패스.

도대체 구글링 해도 시원하게 답해주는 사람이 없어서,

직접 원인을 찾아서 수정한 버전을 사용하기로 함.

반응형

설정

트랙백

댓글