Решил освоить этот язык. Вот моя конфигурация:
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs Configured with: /var/tmp/portage/gcc-3.2.1-r6/work/gcc-3.2.1/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.2 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.2/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,ada,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext Thread model: posix gcc version 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)
Содержимое main.m #import <objc/objc.h> #import <objc/Object.h> #import "MyClass.h"
int main() { MyClass *anObject;
anObject = [MyClass alloc]; //[anObject sayHello]; return 0; }
Содержимое MyClass.h @interface MyClass : Object { } - sayHello; @end
Содержимое MyClass.m #import "MyClass.h"
@implementation MyClass : Object { } - sayHello { printf("Hello, World!\n"); } @end
Линуовщик выдаёт ошибку: main.m:1:2: warning: #import is obsolete, use an #ifndef wrapper in the header file /tmp/ccgoumlF.o(.text+0x19): In function `main': : undefined reference to `objc_get_class' /tmp/ccgoumlF.o(.text+0x2b): In function `main': : undefined reference to `objc_msg_lookup' /tmp/ccgoumlF.o(.text+0x57): In function `_GLOBAL__I_main': : undefined reference to `__objc_exec_class' /tmp/ccgoumlF.o(.data+0x34): undefined reference to `__objc_class_name_MyClass' collect2: ld returned 1 exit status