org-page

static site generator

Code::Blocks 13.12 bug on Mac OS X

When using Code::Blocks, if you read a file using the following code:

ifstream ifs("input.txt")

Then you input.txt should be the same directory as the executable file. However, students using Mac OS report that they can't not find the file using Code::Blocks.

The reason is that Code::Blocks didn't change the current directory to the directory of the executable, but keep it remain in the home directory. A quick fix could be going to Settings -> Environment and change the Terminal to launch console programs to the following line:

osascript -e 'tell app "Terminal"' -e 'activate' -e 'do script "exe=\'$SCRIPT\'; cd \\"${exe%/*}\\"; clear; \\"${exe% }\\""' -e 'end tell'

However, as the download page of Code::Blocks for Mac said, Code::Blocks for Mac is currently not as stable as are other ports, especially on Mountain Lion. So using it on Mac is not recommended.

Comments

comments powered by Disqus