Article View: comp.lang.objective-c
Article #398Help with compiling Objc using gcc
From: Alan L. Liu
Date: Wed, 19 Nov 1997 00:00
Date: Wed, 19 Nov 1997 00:00
35 lines
2214 bytes
2214 bytes
Recently I've tried compiling a "Hello World!" program written in Objective-C using gcc, using both gcc-2.7.2.1 and 2.7.2.3 on three different machines running Linux, all which gave me these errors: prompt> gcc -lobjc -Wno-import -o test main.m Printer.m /tmp/cca006341.o: In function `main': /tmp/cca006341.o(.text+0x19): undefined reference to `objc_get_class' /tmp/cca006341.o(.text+0x24): undefined reference to `objc_msg_lookup' /tmp/cca006341.o(.text+0x3c): undefined reference to `objc_msg_lookup' /tmp/cca006341.o(.text+0x5f): undefined reference to `objc_msg_lookup' /tmp/cca006341.o(.text+0x88): undefined reference to `objc_msg_lookup' /tmp/cca006341.o(.text+0xaf): undefined reference to `objc_msg_lookup' /tmp/cca006341.o: In function `global constructors keyed to main': /tmp/cca006341.o(.text+0xd9): undefined reference to `__objc_exec_class' /tmp/cca006342.o: In function `_i_Printer__init': /tmp/cca006342.o(.text+0x20): undefined reference to `objc_msg_lookup_super' /tmp/cca006342.o(.text+0x41): undefined reference to `objc_msg_lookup' /tmp/cca006342.o: In function `_i_Printer__print': /tmp/cca006342.o(.text+0xc5): undefined reference to `objc_msg_lookup' /tmp/cca006342.o: In function `global constructors keyed to Printer.m': /tmp/cca006342.o(.text+0x129): undefined reference to `__objc_exec_class' /tmp/cca006342.o(.rodata+0x8): undefined reference to `__objc_class_name_Object' prompt> I've tried defining the OBJC_INCLUDE_PATH environment variable, using the -I option, changing to order of the flags, even reinstalling gcc, all to no avail. The weird thing is that I had successfully compiled it without any trouble a month ago. Help! -- Alan Liu surak@imsa.edu
Technical Details
Message-ID:
<64v4m2$8l4$1@java.imsa.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,f5ad7c554583d853,start X-Google-Attributes: gid11318c,public X-Google-Thread: 1111a3,f5ad7c554583d853,start X-Google-Attributes: gid1111a3,public From: Alan L. Liu <surak@imsa.edu> Subject: Help with compiling Objc using gcc Date: 1997/11/19 Message-ID: <64v4m2$8l4$1@java.imsa.edu> X-Deja-AN: 290760680 Organization: Illinois Mathematics and Science Academy Newsgroups: comp.lang.objective-c,gnu.gcc.help