$ gcc.sh Main
Info: resolving ___objc_class_name_NSAutoreleasePool by linking to __imp____objc
_class_name_NSAutoreleasePool (auto-import)
Info: resolving ___objc_class_name_NSConstantString by linking to __imp____objc_
class_name_NSConstantString (auto-import)
e:/program files/gnustep/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/
bin/ld.exe: warning: auto-importing has been activated without --enable-auto-imp
ort specified on the command line.
This should work unless it involves constant data structures referencing symbols
from auto-imported DLLs.
C:/DOCUME~1/WORKSP~1/LOCALS~1/Temp/ccsTkH2l.o:Main.m:(.data+0x104): undefined re
ference to `__objc_class_name_Engine'
C:/DOCUME~1/WORKSP~1/LOCALS~1/Temp/ccsTkH2l.o:Main.m:(.data+0x108): undefined re
ference to `__objc_class_name_Wheel'
collect2: ld returned 1 exit status
错误的方法:
gcc -o Main Main.m -I/GNUstep/System/Library/Headers -fconstant-string-class=NSConstantString -L/GNUstep/System/Library/Libraries -lobjc -lgnustep-base
正确的方法:
gcc -o Main Main.o Car.o Wheel.o Engine.o -I/GNUstep/System/Library/Headers -fconstant-string-class=NSConstantString -L/GNUstep/System/Library/Libraries -lobjc -lgnustep-base