Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer Help > Re: Cocoa Newbi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 14 of 43 Topic 3769 of 3882
Post > Topic >>

Re: Cocoa Newbie Question.

by piscesboy <oraclmaster@[EMAIL PROTECTED] > Jun 11, 2008 at 07:05 PM

On Jun 11, 8:58=A0pm, Dave Seaman <dsea...@[EMAIL PROTECTED]
> wrote:
> On Wed, 11 Jun 2008 15:35:52 -0700 (PDT), piscesboy wrote:
> > I tried something different albeit much simpler. This might clear
> > things up. Here is the makefile I am using to compile this newer, much
> > simpler program of mine that mixes Objective-C and regular C code:
> > TARGET=3Dtest
> > DEBUG=3Ddebugtest
> > GCC=3Dgcc -ansi -pedantic -Wall -O2 -o
> > GCCOP=3Dgcc -ansi -pedantic -Wall -O2 -c
> > GCCMOP=3Dgcc -x objective-c -framework Foundation -c
> > OBJECTS=3Dmain.o Person.o treenode.o
> > SOURCE=3Dmain.m Person.m treenode.c
> > TRASH=3D*.o *.c~ *.h~ $(TARGET) $(DEBUG) Makefile~
> > $(TARGET): $(OBJECTS) $(SOURCE)
> > =A0 =A0$(GCC) $(TARGET) $(OBJECTS)
> > main.o: main.m defs.h
> > =A0 =A0$(GCCMOP) main.m
> > Person.o: Person.m Person.h
> > =A0 =A0$(GCCMOP) Person.m
> > treenode.o: treenode.c treenode.h
> > =A0 =A0$(GCCMOP) treenode.c
> > clean:
> > =A0 =A0rm -f $(TRASH)
> > My target is called test and depends on the objective-C files main.m,
> > and Person.m and the regular C file treenode.c
> > This is the error produced when I type 'make':
> > gcc -x objective-c -framework Foundation -c main.m
> > powerpc-apple-darwin8-gcc-4.0.1: -framework: linker input file unused
> > because linking not done
> > powerpc-apple-darwin8-gcc-4.0.1: Foundation: linker input file unused
> > because linking not done
> > gcc -x objective-c -framework Foundation -c Person.m
> > powerpc-apple-darwin8-gcc-4.0.1: -framework: linker input file unused
> > because linking not done
> > powerpc-apple-darwin8-gcc-4.0.1: Foundation: linker input file unused
> > because linking not done
> > gcc -x objective-c -framework Foundation -c treenode.c
> > powerpc-apple-darwin8-gcc-4.0.1: -framework: linker input file unused
> > because linking not done
> > powerpc-apple-darwin8-gcc-4.0.1: Foundation: linker input file unused
> > because linking not done
> > gcc -ansi -pedantic -Wall -O2 -o test main.o Person.o treenode.o
> > /usr/bin/ld: Undefined symbols:
> > .objc_class_name_NSConstantString
> > .objc_class_name_NSObject
> > .objc_class_name_NSString
> > __NSConstantStringClassReference
> > _objc_msgSend
> > _objc_msgSendSuper
> > collect2: ld returned 1 exit status
> > make: *** [test] Error 1
>
> You need "-framework Foundation" when you are linking, but not
otherwise.
> In fact, you did just the opposite, and this accounts for all the
warning
> messages and the undefined symbols error.
>
> The "-c" flag means "just compiile, don't link". =A0That's exactly what
yo=
u
> want to do on all the steps except the last one, but you are causing the
> compiler to point out repeatedly that it makes no sense to specify both
> "-c" and "-framework Foundation" on the same command line.
>
> > I think I know what is going on: that I am not linking the generated
> > object files properly. I do not know how to properly invoke the linker
> > to link the generated objective-c files mixed with C files.
>
> On the last step, where you are actually doing the linking, you left out
> "-framework Foundation". =A0This is the reason for the "Undefined
symbols"=

> error on the link step.
>
> By the way, "test" is a very poor choice for the name of an executable
> program. =A0Don't be surprised if executing the program appears to
produce=

> no response at all, since "test" is a shell builtin.

It is in fact a "test".  A dummy program that I built to learn about
Objective-C. It isn't meant to be proprietary software or a final
release at all. I have exactly 24 hours worth of Objective-C
experience as of this posting, so I am very much a novice at this
stuff.


>
> --
> Dave Seaman
> Third Circuit ignores precedent in Mumia Abu-Jamal ruling.
> <http://www.indybay.org/newsitems/2008/03/29/18489281.php>
 




 43 Posts in Topic:
Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-11 10:51:10 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-11 11:17:42 
Re: Cocoa Newbie Question.
Reinder Verlinde <rein  2008-06-11 23:14:31 
Re: Cocoa Newbie Question.
Dave Seaman <dseaman@[  2008-06-11 22:37:00 
Re: Cocoa Newbie Question.
le chiffre <oraclmaste  2008-06-12 23:41:20 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-13 10:54:13 
Re: Cocoa Newbie Question.
Jim <jim@[EMAIL PROTEC  2008-06-13 16:04:43 
Re: Cocoa Newbie Question.
Ben Artin <macdev@[EMA  2008-06-13 08:14:16 
Re: Cocoa Newbie Question.
Jim <jim@[EMAIL PROTEC  2008-06-13 16:31:50 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-12 23:55:45 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-11 15:35:52 
Re: Cocoa Newbie Question.
Ben Artin <macdev@[EMA  2008-06-11 15:49:53 
Re: Cocoa Newbie Question.
Dave Seaman <dseaman@[  2008-06-12 00:58:51 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-11 19:05:58 
Re: Cocoa Newbie Question.
Dave Seaman <dseaman@[  2008-06-12 02:18:43 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-11 22:00:09 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-11 22:05:19 
Re: Cocoa Newbie Question.
Dave Seaman <dseaman@[  2008-06-12 12:24:39 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-11 22:08:58 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-12 09:07:43 
Re: Cocoa Newbie Question.
Dave Seaman <dseaman@[  2008-06-12 16:32:15 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-12 13:11:55 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-12 09:52:06 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-12 13:19:58 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-12 10:31:23 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-12 15:06:29 
Re: Cocoa Newbie Question.
Chris Hanson <cmh@[EMA  2008-06-15 16:35:00 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-12 10:34:23 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-12 15:14:39 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-12 12:31:08 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-12 16:30:16 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-12 13:50:06 
Re: Cocoa Newbie Question.
jim@[EMAIL PROTECTED] (j  2008-06-13 06:15:18 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-13 10:52:57 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-13 11:08:59 
Re: Cocoa Newbie Question.
piscesboy <oraclmaster  2008-06-15 16:58:27 
Re: Cocoa Newbie Question.
jim@[EMAIL PROTECTED] (j  2008-06-16 08:33:05 
Re: Cocoa Newbie Question.
Gregory Weston <uce@[E  2008-06-16 08:58:21 
Re: Cocoa Newbie Question.
jim@[EMAIL PROTECTED] (j  2008-06-16 15:23:01 
Re: Cocoa Newbie Question.
glenn andreas <gandrea  2008-06-16 13:56:37 
Re: Cocoa Newbie Question.
Steven Fisher <sdfishe  2008-06-20 13:42:49 
Re: Cocoa Newbie Question.
Steven Fisher <sdfishe  2008-06-20 13:48:07 
Re: Cocoa Newbie Question.
"P. Sture" <  2008-06-22 11:24:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 10:50:29 CST 2008.