5

GNUStepを使用せずにubuntuで目的のCプログラムをコンパイルする方法はありますか? デフォルトの C 標準ライブラリと、Objective-C の OOB 構文を除くすべてを使用したいと考えています。私が今抱えている問題は、すべてのメソッドを起動したら、それらを呼び出す方法が必要なことです。Mac では割り当てて初期化するだけですが、Linux ではこれをコンパイルしようとすると、clang でエラーが発生します。

#include <stdio.h> // C standard IO library (for printf)
#include <stdlib.h> // C standard library
// Interface
@interface test
 -(void)sayHello :(char *)message;
@end

// Implementation
@implementation test
 -(void)sayHello :(char *)message {
  printf("%s", message);
 }

int main(int argc, char *argv[]) {
 test *test = [[test alloc] init];
 [test sayHello:"Hello world"];
}
4

2 に答える 2