Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Xcode issues, doesn't compile files |
| Date | 2015-04-23 13:02 -0700 |
| Organization | None to speak of |
| Message-ID | <87h9s6ipf2.fsf@kst-u.example.com> (permalink) |
| References | <f48581af-5efd-4b44-b982-d64c048adc2e@googlegroups.com> |
Alla _ <modelling.data@gmail.com> writes:
> I've written simple programs from Chapter 3 exercises (Programming in
> C). A few people have tested them on their machines, and they work:
> their Xcode compiles both programs. My one does not.
>
> Here is the first one.
>
> #include <math.h>
> #include <stdio.h>
>
> int main (void)
> {
> float x = 2.55, y1, y2 ;
> int i = 3, z = 2 ;
> y1 = pow( x, i ) ;
> y2 = pow( x, z ) ;
> float result ;
>
> result = 3 * y1 - 5 * y2 + 6 ;
> printf ("If x equals %f, then the given polynomial equals %f\n", x, result) ;
>
> return 0 ;
> }
>
> Here is what I get after trying to compile:
>
> alla [11:41 AM]
> 95-28-37-123:~ Alla$ gcc Prog3task6add.c -o Prog3task6add
> Undefined symbols for architecture x86_64:
> "_main", referenced from:
> start in crt1.10.6.o
> ld: symbol(s) not found for architecture x86_64
> collect2: ld returned 1 exit status
Given the error message, I expect that you'd get the same error
compiling the following 1-line program:
int main(void) { }
You should be able to compile it with
gcc -c foo.c
but you'll get the same error as above if you try to compile and link it
using
gcc foo.c -o foo
Your code is correct and your command line are correct. Apparently your
implementation is not configured correctly; perhaps some component
wasn't installed.
Since we deal with the C *language* here, this is not the best place to
ask for advice on this particular problem. You need to find a forum
that deals with Xcode configuration issues. It's likely others have
encountered the same problem. A Google search for "Xcode undefined
symbol _main" (without the quotes) turns up a number of hits; I haven't
taken the time to check which ones are relevant to your problem.
You might find that stackoverflow.com is a good place for questions like
this. (Do a search first to see if your question has already been asked
and answered.)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Xcode issues, doesn't compile files Alla _ <modelling.data@gmail.com> - 2015-04-23 02:53 -0700
Re: Xcode issues, doesn't compile files Bartc <bc@freeuk.com> - 2015-04-23 11:51 +0100
Re: Xcode issues, doesn't compile files Alla _ <modelling.data@gmail.com> - 2015-04-23 04:39 -0700
Re: Xcode issues, doesn't compile files Bartc <bc@freeuk.com> - 2015-04-23 13:19 +0100
Re: Xcode issues, doesn't compile files Alla _ <modelling.data@gmail.com> - 2015-04-23 07:20 -0700
Re: Xcode issues, doesn't compile files Bartc <bc@freeuk.com> - 2015-04-23 15:33 +0100
Re: Xcode issues, doesn't compile files Alla _ <modelling.data@gmail.com> - 2015-04-23 08:50 -0700
Re: Xcode issues, doesn't compile files Johann Klammer <klammerj@NOSPAM.a1.net> - 2015-04-23 20:31 +0200
Re: Xcode issues, doesn't compile files Robert Wessel <robertwessel2@yahoo.com> - 2015-04-23 14:25 -0500
Re: x86_64 Noob <root@127.0.0.1> - 2015-04-23 21:39 +0200
Re: Xcode issues, doesn't compile files G G <gdotone@gmail.com> - 2015-04-23 12:50 -0700
Re: Xcode issues, doesn't compile files Alla _ <modelling.data@gmail.com> - 2015-04-24 10:37 -0700
Re: Xcode issues, doesn't compile files G G <gdotone@gmail.com> - 2015-04-24 11:15 -0700
Re: Xcode issues, doesn't compile files Keith Thompson <kst-u@mib.org> - 2015-04-23 13:02 -0700
Re: Xcode issues, doesn't compile files Alla _ <modelling.data@gmail.com> - 2015-04-24 06:22 -0700
Re: Xcode issues, doesn't compile files G G <gdotone@gmail.com> - 2015-04-24 10:13 -0700
Re: Xcode issues, doesn't compile files Alla _ <modelling.data@gmail.com> - 2015-04-24 10:34 -0700
Re: Xcode issues, doesn't compile files Hiidenkivi <hiidenkivi@nospam.no> - 2015-04-25 14:41 +0300
Re: Xcode issues, doesn't compile files Hiidenkivi <hiidenkivi@nospam.no> - 2015-04-25 15:05 +0300
Re: Xcode issues, doesn't compile files Keith Thompson <kst-u@mib.org> - 2015-04-25 13:25 -0700
Re: Xcode issues, doesn't compile files Hiidenkivi <hiidenkivi@nospam.no> - 2015-05-03 23:29 +0300
Re: Xcode issues, doesn't compile files Keith Thompson <kst-u@mib.org> - 2015-05-03 13:46 -0700
Re: Xcode issues, doesn't compile files Hiidenkivi <hiidenkivi@nospam.no> - 2015-05-04 03:06 +0300
Re: Xcode issues, doesn't compile files Keith Thompson <kst-u@mib.org> - 2015-05-03 18:06 -0700
csiph-web