Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #60942

Re: Xcode issues, doesn't compile files

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Xcode issues, doesn't compile files
Date Thu, 23 Apr 2015 13:02:25 -0700
Organization None to speak of
Lines 65
Message-ID <87h9s6ipf2.fsf@kst-u.example.com> (permalink)
References <f48581af-5efd-4b44-b982-d64c048adc2e@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="9be37d943435275679235b07c7947eef"; logging-data="15780"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vJv7tklWivsHP3QD6m3qX"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:jI1Ql8A0KXO83v15llB7En3AGgM= sha1:QjRTPF2cZ3L/Bb0nKniQR+1XtIc=
Xref csiph.com comp.lang.c:60942

Show key headers only | View raw


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


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