1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Linking against ssl. Simple SSL example.

Discussion in 'Mac Programming' started by oakcreeker, Feb 6, 2008.

  1. macrumors newbie

    #1
    Anyone give me any suggestions on how to fix or where to find help for linking problems with ssl? I've copied a simple ssl example program from here: simple ssl client example I fixed a couple of compile errors, and then dragged the .dylib from /usr/lib/libssl.0.9.7.dylib to the "Link Binary With Library" for the target in XCode. I get a bunch of link errors:

    Undefined symbols:
    "_X509_free", referenced from:
    _main in main.o
    "_X509_get_subject_name", referenced from:
    _main in main.o
    "_X509_NAME_oneline", referenced from:
    _main in main.o
    _main in main.o
    "_X509_get_issuer_name", referenced from:
    _main in main.o
    "_ERR_print_errors_fp", referenced from:
    _main in main.o
    ld: symbol(s) not found

    ...

    I don't think I'm linking properly. Btw, I have tried compiling it from the command line ... same errors.

    $ g++ -o simple_ssl main.cpp -lsslUndefined symbols:
    "_X509_free", referenced from:
    _main in ccSTv0wZ.o
    "_X509_get_subject_name", referenced from:
    _main in ccSTv0wZ.o
    "_X509_NAME_oneline", referenced from:
    _main in ccSTv0wZ.o
    _main in ccSTv0wZ.o
    "_X509_get_issuer_name", referenced from:
    _main in ccSTv0wZ.o
    "_ERR_print_errors_fp", referenced from:
    _main in ccSTv0wZ.o
    _main in ccSTv0wZ.o
    _main in ccSTv0wZ.o
    _main in ccSTv0wZ.o
    _main in ccSTv0wZ.o
    _main in ccSTv0wZ.o
    _main in ccSTv0wZ.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    Thanks in advance.

    Derrick
     
  2. Moderator emeritus

    kainjow

    #2
    I think you might need to link against libcrypto as well.
     
  3. macrumors newbie

    #3
    That did it. Thanks, kainjow, for the solution.

    Derrick
     

Share This Page