Professional Web Applications Themes

Cocoa Project + GMP Problem... - Mac Programming

Hello all, I have installed GMP version 4.1.2, a mathematics computing library, whereby I can do arbitrary length integer, float, etc. calculations. I first tested it with a simple C program: <code> #include <stdio.h> #include <gmp.h> main() { char c[200]; mpz_t pi; mpz_init_set_str(pi, "3141592653589793238462643383279502884", 10); mpz_get_str(c, 10, pi); printf("%s\n", c); } </code> This code simply initialises a variable called pi to pi's value, and prints it out again. The thing is, is that this worked fine. Note that I had to compile it using the -lgmp flag, as said in the doentation. When I tried to use GMP in a ...

  1. #1

    Default Cocoa Project + GMP Problem...

    Hello all,
    I have installed GMP version 4.1.2, a mathematics computing library,
    whereby I can do arbitrary length integer, float, etc. calculations.

    I first tested it with a simple C program:

    <code>
    #include <stdio.h>
    #include <gmp.h>

    main() {
    char c[200];
    mpz_t pi;
    mpz_init_set_str(pi, "3141592653589793238462643383279502884",
    10);
    mpz_get_str(c, 10, pi);
    printf("%s\n", c);
    }
    </code>

    This code simply initialises a variable called pi to pi's value, and
    prints it out again. The thing is, is that this worked fine. Note that
    I had to compile it using the -lgmp flag, as said in the doentation.

    When I tried to use GMP in a Cocoa project, I compiled the project, and
    the Build pane gives me an error in the Linking phase:

    Warning prebinding disable because of undefined symbols
    Undefined symbols: ___gmpz_get_str ___gmpz_init_set_str
    Build failed (1 error, 1 warning)

    Why is this happening? I have also edited the active target, and in the
    Build settings I added '-lgmp', (without the quotes), in the 'Other C
    Compiler Flags' field.

    What have I done wrong?

    Thanks in advance,
    Mark Bee.
    Mark Bee Guest

  2. #2

    Default Re: Cocoa Project + GMP Problem...

    In <1fzuwac.1m4ll281j5nh1cN%markbeeanon.com.au> Mark Bee wrote:
    > OK, I managed to fix that error, but then I get this warning:
    >
    > Warning prebinding disabled because dependent library:
    > /usr/local/lib/libgmp.3.dylib is not prebound
    >
    > What does this mean? Is it important?
    I don't think it's important. You can the turn the warning off in your
    project's target by telling it not to be interested in prebinding.
    Alternatively you can try to prebind the library with update_prebinding.
    m.

    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

  3. #3

    Default Re: Cocoa Project + GMP Problem...

    > I don't think it's important. You can the turn the warning off in your
    > project's target by telling it not to be interested in prebinding.
    > Alternatively you can try to prebind the library with update_prebinding.
    It seems that the compiled app doesn't start up on the other Mac I'm
    running here, (GMP not installed - and won't be), and it works fine on
    the one that I'm working on it, on. On the other Mac, it bounces in the
    Dock, but then disappears all by itself, (like an app that has quit) --
    no warnings, error messages, nothing -- it simply quits. No windows are
    displayed, etc...

    This update_prebinding thing. How do I use it? I know it's a UNIX
    utility run from the command line, but how do I use it? I've read the
    man file, but it doesn't really make much sense to me. I don't even
    know where it's been installed on my system. (Apparently the gmp.h file
    is in the directory:
    ../../usr/local/include
    The .info files are in:
    ../../usr/local/info
    And the files:
    libgmp.3.3.2.dylib, libgmp.3.dylib, libgmp.a, libgmp.dylib,
    libgmp.la are in:
    ../../usr/local/lib

    etc...

    Finally, what I've done in the Cocoa project, is simply typed
    #include <gmp.h>
    in the class file header I'm using GMP in. Would it be better if I
    simply dragged the gmp-4.1.2/ folder into the 'Groups & Files' list in
    Pb, and changed #include <gmp.h> to #include "gmp-4.1.2/gmp.h"?

    Thanks for the answers to my many questions. :-)

    Thanks in advance,
    Mark Bee.
    Mark Bee Guest

  4. #4

    Default Re: Cocoa Project + GMP Problem...

    In <1fzw0ku.1603o041tydq8sN%markbeeanon.com.au> Mark Bee wrote:
    > Thanks for the answers to my many questions.
    If you don't get any, ask on Apple's Project Builder Users mailing list.
    m.

    --
    matt neuburg, phd = [email]matttidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

Similar Threads

  1. MacOSX project menu problem
    By Joshua Davies webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 0
    Last Post: January 15th, 05:21 PM
  2. Replies: 2
    Last Post: October 6th, 06:51 PM
  3. Cocoa: problem dragging PDF image rep into Keynote slide
    By Eric Raas in forum Mac Programming
    Replies: 0
    Last Post: September 15th, 12:33 PM
  4. MAC problem with my PC project
    By Dig in forum Macromedia Flash
    Replies: 1
    Last Post: August 23rd, 02:27 AM
  5. New Web Project problem
    By Andrew J in forum ASP.NET General
    Replies: 1
    Last Post: July 9th, 03:42 PM

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