Professional Web Applications Themes

Cocoa + Xcode + GMP = What the? - Mac Programming

Hello all, I am having a problem compiling and running a simple cocoa application written in Xcode, which uses the GMP library. For some reason it says: ld: Undefined symbols: ___gmpz_get_str ___gmpz_init ___gmpz_init_set_str ___gmpz_powm which are the only functions I have used from the GMP library. Yet it recognises GMP defined types that I have declared in thesource file, (namely: mpz_t). I have tried to set the additional compiler flags to contain "-lgmp" for the relevant Obj-C file which is required for GMP, but I'm not sure Xcode is keeping it. So I can't even build and test my application. ...

  1. #1

    Default Cocoa + Xcode + GMP = What the?

    Hello all,
    I am having a problem compiling and running a simple cocoa application
    written in Xcode, which uses the GMP library. For some reason it says:
    ld: Undefined symbols:
    ___gmpz_get_str
    ___gmpz_init
    ___gmpz_init_set_str
    ___gmpz_powm
    which are the only functions I have used from the GMP library. Yet it
    recognises GMP defined types that I have declared in thesource file,
    (namely: mpz_t).

    I have tried to set the additional compiler flags to contain "-lgmp" for
    the relevant Obj-C file which is required for GMP, but I'm not sure
    Xcode is keeping it. So I can't even build and test my application.

    Have I missed something, or is this a bug in Xcode?

    Thanks in advnace.
    MB.
    M Guest

  2. #2

    Default Xcode Bug (was Cocoa + GMP = What The?)

    > I have tried to set the additional compiler flags to contain "-lgmp" for 

    I have deduced tht this must be a bug in Xcode. I keep typing "-lgmp",
    (without the quotes), into the "Addtional Compiler Flags: " field, and
    it just removes it by itself.

    Has anyone else had this trouble? This is a ridiculous bug to exist.
    mb.
    M Guest

  3. #3

    Default Re: Cocoa + Xcode + GMP = What the?

    In article <1g4s171.jl73cf961i9qN%com>,
    com (M) wrote:
     

    You need to understand the difference between the compiler and the
    linker. Recognizing defined types in your files is up to the compiler.
    The only thing that's necessary to happen is for you to include the
    appropriate headers, so it's no surprise that works. Linking in the
    correct library is different, so it's perfectly normal that you can
    compile but not link.

    In any case, just drag the library file directly into your project, and
    Xcode should link correctly.
    Michael Guest

  4. #4

    Default Re: Cocoa + Xcode + GMP = What the?

    > You need to understand the difference between the compiler and the 

    Sorry, I was being hasty in my post. I know the difference, for the
    most part. Anyway, thanks for opinting it out. ;-)
     

    But how can I drag an invisible file, gmp.h, from /usr/local/ which is
    invisible? mb.
    M Guest

  5. #5

    Default Re: Cocoa + Xcode + GMP = What the?

    > You need to understand the difference between the compiler and the 

    Sorry, I forgot to say.

    The "bug" of not being able to add additional compiler flags, (like
    -lgmp - which I believe is for linking the relevant file to the GMP
    library - I may be wrong here ;-) ), which was possible in Project
    Builder, and made it compile and link properly, still persists in Xcode.

    Has anyone else experienced this shortcoming? mb.
    M Guest

  6. #6

    Default Re: Cocoa + Xcode + GMP = What the?

    In article <1g4si17.lw2j212qk2m2N%com>,
    com says...
     
    >
    > But how can I drag an invisible file, gmp.h, from /usr/local/ which is
    > invisible? mb.
    >[/ref]

    In a terminal type 'open /usr/local' to open a Finder window on that
    directory and drag from there.
    James Guest

  7. #7

    Default Re: Cocoa + Xcode + GMP = What the?

    In article <1g4si9b.pu1rapkhfggaN%com>,
    com (M) wrote:
     

    This worked in PB and I would be surprised if it didn't work in Xcode.
    But you have to add it to your *linker* flags, since it's part of the
    link process, not to your compiler flags. Is that what you actually did?
    Adding -lgmp to your compiler flags will not do anything.
    Michael Guest

  8. #8

    Default Re: Cocoa + Xcode + GMP = What the?

    > This worked in PB and I would be surprised if it didn't work in Xcode. 

    Although I have only been using Xcode for a day or two, after upgrading
    to Panther, I cannot seem to find this. Where exactly is it?

    For memory, in Project Builder, this is the equivalent of where I put
    the -lgmp flag.

    Thanks in advence. mb.
    M Guest

  9. #9

    Default Re: Cocoa + Xcode + GMP = What the?

    > In a terminal type 'open /usr/local' to open a Finder window on that 

    Of course. I didn't think of that. mb. ;-)
    M Guest

  10. #10

    Default Re: Cocoa + Xcode + GMP = What the?

    In article <1g4tltr.zcgszoc4ri0wN%com>,
    com (M) wrote:
     
    >
    > Of course. I didn't think of that. mb. ;-)[/ref]

    More firendly UI is the "Go To Folder" menu item in the Finder.

    hth

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

  11. #11

    Default Re: Cocoa + Xcode + GMP = What the?

    In article <1g4tlru.unv32c1wbgahoN%com>,
    com (M) wrote:
     
    >
    > Although I have only been using Xcode for a day or two, after upgrading
    > to Panther, I cannot seem to find this. Where exactly is it?
    >
    > For memory, in Project Builder, this is the equivalent of where I put
    > the -lgmp flag.[/ref]

    I'm assuming you're using a native Xcode target; the location is
    different for an old-style target, but then again it's the same location
    as in PB for those. Get info on your target, go to the Build tab, hit
    Current Settings, and "Other linker flags" in the fourth one down on
    mine.
    Michael Guest

  12. #12

    Default Re: Cocoa + Xcode + GMP = What the?

    In article <Individual.NET>,
    James Weatherley <net> wrote:
     

    Or, even easier, use the Finder's "Go to folder..." menu item.

    Cheers,
    -- Uli
    http://www.zathras.de
    Uli Guest

Similar Threads

  1. 10.3, Xcode, SetSystemUIMode
    By Simon in forum Mac Programming
    Replies: 2
    Last Post: November 17th, 01:06 AM
  2. Problems with Xcode
    By F. in forum Mac Programming
    Replies: 3
    Last Post: October 31st, 09:53 PM
  3. Xcode editor
    By Mike in forum Mac Programming
    Replies: 4
    Last Post: October 30th, 10:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139