Well, after hours of trying I finally found out what my mistake was. In fact, the solution has been quite easy, I only had to delete the {$mode objfpc} statement and it compiled without problems

Meanwhile I also tried out Open Kylix 3, which unfortunaltey crashes whenever I compile a program without errors .