1

私はこのコードをコンパイルしようとしました:

// Frist program example 

#import Foundation/Foundation.h>

int main (int argc, const char * argv [])
{
  NSAutoreleasePool * pool - [[NSAutoreleasePool alloc] init];
  NSLog (@"Programming is fun!");

  [pool drain];
  return 0;
}     

しかし、ファイル名を入力すると、コンパイラからエラーメッセージが表示されます。

./prog1.m:1行目://:ディレクトリ
です./prog1.m:6行目:予期しないトークンの近くの構文エラー'('
./prog1.m:6行目:'int main(int argc、const char * argv []) '

4

1 に答える 1

2

あなたがし-たい場所を持っています=

これを試して:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv [])
{
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  NSLog (@"Programming is fun!");

  [pool drain];
  return 0;
}     
于 2011-07-13T18:03:06.000 に答える