Error Log while compilation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • singhPrabhat
    New Member
    • Aug 2008
    • 12

    Error Log while compilation

    I have some .c and .h files in my directory. My aim is to compile the whole file. I am compiling each and every .c file by
    gcc -c file_name then I use gcc -o some_text file_name.

    I have found out that some file starts with #ifdef UNIX. But UNIX is nowhere defined in either header file(.h file) it includes not in the file itself.

    For the time being I am defining as #include UNIX in the file whereever required.

    some of the files getting compiled by gcc -c file_name and creates coressponding object file. but when I try to use
    gcc -o some_text file_name then get the following error.


    /usr/lib64/gcc/x86_64-suse-linux/4.2.1/../../../../lib64/crt1.o: In function `_start':
    (.text+0x20): undefined reference to `main'
    /tmp/ccsbV9J2.o: In function `CCWebSSLPrintL astError':
    CCWebSSL.c:(.te xt+0xfc): undefined reference to `CCWebLog'
    CCWebSSL.c:(.te xt+0x12a): undefined reference to `ERR_get_error_ line_data'
    CCWebSSL.c:(.te xt+0x14e): undefined reference to `ERR_error_stri ng_n'
    CCWebSSL.c:(.te xt+0x24d): undefined reference to `CCWebLog'
    /tmp/ccsbV9J2.o: In function `CCWebSSLVerify CallBack':
    CCWebSSL.c:(.te xt+0x274): undefined reference to `X509_STORE_CTX _get_current_ce rt'
    CCWebSSL.c:(.te xt+0x281): undefined reference to `X509_STORE_CTX _get_error'
    CCWebSSL.c:(.te xt+0x28d): undefined reference to `X509_get_subje ct_name'
    CCWebSSL.c:(.te xt+0x29f): undefined reference to `X509_NAME_onel ine'
    CCWebSSL.c:(.te xt+0x2b5): undefined reference to `X509_get_issue r_name'
    CCWebSSL.c:(.te xt+0x2c7): undefined reference to `X509_NAME_onel ine'
    /tmp/ccsbV9J2.o: In function `CCWebSSLClient PasswordCallBac k':
    CCWebSSL.c:(.te xt+0x334): undefined reference to `CCWebLog'
    /tmp/ccsbV9J2.o: In function `CCWebSSLInitia lization':
    CCWebSSL.c:(.te xt+0x36f): undefined reference to `SSL_library_in it'
    CCWebSSL.c:(.te xt+0x374): undefined reference to `SSL_load_error _strings'
    CCWebSSL.c:(.te xt+0x379): undefined reference to `CRYPTO_num_loc ks'
    CCWebSSL.c:(.te xt+0x400): undefined reference to `pthread_mutexa ttr_init'
    CCWebSSL.c:(.te xt+0x42b): undefined reference to `pthread_mutexa ttr_setpshared'
    CCWebSSL.c:(.te xt+0x4cd): undefined reference to `pthread_mutexa ttr_destroy'
    CCWebSSL.c:(.te xt+0x516): undefined reference to `CRYPTO_set_id_ callback'
    CCWebSSL.c:(.te xt+0x520): undefined reference to `CRYPTO_set_loc king_callback'
    CCWebSSL.c:(.te xt+0x531): undefined reference to `RAND_seed'
    CCWebSSL.c:(.te xt+0x536): undefined reference to `RAND_status'
    /tmp/ccsbV9J2.o: In function `CCWebSSLTermin ation':
    CCWebSSL.c:(.te xt+0x55f): undefined reference to `CRYPTO_set_loc king_callback'
    CCWebSSL.c:(.te xt+0x59b): undefined reference to `CRYPTO_num_loc ks'
    /tmp/ccsbV9J2.o: In function `CCWebSSLFreeSe ssionData':
    CCWebSSL.c:(.te xt+0x5f6): undefined reference to `SSL_SESSION_fr ee'
    /tmp/ccsbV9J2.o: In function `CCWebSSL':
    CCWebSSL.c:(.te xt+0xe8a): undefined reference to `SSLv23_client_ method'
    CCWebSSL.c:(.te xt+0xed2): undefined reference to `SSLv2_client_m ethod'
    CCWebSSL.c:(.te xt+0xf16): undefined reference to `SSLv3_client_m ethod'
    CCWebSSL.c:(.te xt+0xf67): undefined reference to `SSL_CTX_new'
    CCWebSSL.c:(.te xt+0x1041): undefined reference to `SSL_CTX_set_ci pher_list'
    CCWebSSL.c:(.te xt+0x1065): undefined reference to `iConfiguration SSLCertificateC heck'
    CCWebSSL.c:(.te xt+0x1080): undefined reference to `SSL_CTX_load_v erify_locations '
    CCWebSSL.c:(.te xt+0x10a9): undefined reference to `SSL_CTX_set_ve rify'
    CCWebSSL.c:(.te xt+0x10b5): undefined reference to `SSL_new'
    CCWebSSL.c:(.te xt+0x10e7): undefined reference to `SSL_set_fd'
    CCWebSSL.c:(.te xt+0x1108): undefined reference to `SSL_get_error'
    CCWebSSL.c:(.te xt+0x1239): undefined reference to `SSL_set_sessio n'
    CCWebSSL.c:(.te xt+0x1280): undefined reference to `SSL_connect'
    CCWebSSL.c:(.te xt+0x12bd): undefined reference to `SSL_get_error'
    CCWebSSL.c:(.te xt+0x1326): undefined reference to `SSL_shutdown'
    CCWebSSL.c:(.te xt+0x1332): undefined reference to `SSL_free'
    CCWebSSL.c:(.te xt+0x1349): undefined reference to `SSL_CTX_free'
    CCWebSSL.c:(.te xt+0x13ca): undefined reference to `CCWebLog'
    CCWebSSL.c:(.te xt+0x1643): undefined reference to `SSL_get_verify _result'
    CCWebSSL.c:(.te xt+0x168d): undefined reference to `CCWebLog'
    CCWebSSL.c:(.te xt+0x16ad): undefined reference to `SSL_SESSION_fr ee'
    CCWebSSL.c:(.te xt+0x17bd): undefined reference to `SSL_shutdown'
    CCWebSSL.c:(.te xt+0x17c9): undefined reference to `SSL_free'
    CCWebSSL.c:(.te xt+0x17e0): undefined reference to `SSL_CTX_free'
    CCWebSSL.c:(.te xt+0x1810): undefined reference to `SSL_get_verify _result'
    CCWebSSL.c:(.te xt+0x18de): undefined reference to `SSL_get_sessio n'
    CCWebSSL.c:(.te xt+0x1979): undefined reference to `SSL_SESSION_fr ee'
    CCWebSSL.c:(.te xt+0x1a97): undefined reference to `SSL_get1_sessi on'
    CCWebSSL.c:(.te xt+0x1c6e): undefined reference to `SSL_SESSION_fr ee'
    CCWebSSL.c:(.te xt+0x1cb5): undefined reference to `CCWebCookieStr ing'
    CCWebSSL.c:(.te xt+0x24b2): undefined reference to `iDumpLevel'
    CCWebSSL.c:(.te xt+0x24d3): undefined reference to `CCWebLog'
    CCWebSSL.c:(.te xt+0x2514): undefined reference to `SSL_write'
    CCWebSSL.c:(.te xt+0x2546): undefined reference to `SSL_get_error'
    CCWebSSL.c:(.te xt+0x2775): undefined reference to `SSL_pending'
    CCWebSSL.c:(.te xt+0x29aa): undefined reference to `SSL_read'
    CCWebSSL.c:(.te xt+0x29e6): undefined reference to `SSL_get_error'
    CCWebSSL.c:(.te xt+0x2ced): undefined reference to `iDumpLevel'
    CCWebSSL.c:(.te xt+0x2d02): undefined reference to `iDumpLevel'
    CCWebSSL.c:(.te xt+0x2d20): undefined reference to `iDumpLevel'
    CCWebSSL.c:(.te xt+0x2d32): undefined reference to `iDumpLevel'
    CCWebSSL.c:(.te xt+0x2d4a): undefined reference to `iDumpLevel'
    /tmp/ccsbV9J2.o:CCWe bSSL.c:(.text+0 x2d55): more undefined references to `iDumpLevel' follow
    /tmp/ccsbV9J2.o: In function `CCWebSSL':
    CCWebSSL.c:(.te xt+0x2d81): undefined reference to `CCWebLog'
    CCWebSSL.c:(.te xt+0x2d87): undefined reference to `iDumpLevel'
    CCWebSSL.c:(.te xt+0x2d92): undefined reference to `iDumpLevel'
    CCWebSSL.c:(.te xt+0x2dd1): undefined reference to `CCWebLog'
    CCWebSSL.c:(.te xt+0x2df7): undefined reference to `ERR_remove_sta te'
    CCWebSSL.c:(.te xt+0x2e03): undefined reference to `SSL_shutdown'
    CCWebSSL.c:(.te xt+0x2e27): undefined reference to `SSL_free'
    CCWebSSL.c:(.te xt+0x2e4b): undefined reference to `SSL_CTX_free'
    collect2: ld returned 1 exit status


    Thanks
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Try to compile and link all your files in one go:

    [code=c]
    gcc *.c -o outputfile
    [/code]

    If that UNIX flag isn't defined anywhere and you're not on a Unix box: fine; otherwise
    define it yourself on the compiler's command line:

    [code=c]
    gcc -DUNIX *.c -o outputfile
    [/code]

    kind regards,

    Jos

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      I assume some_text_file_ name includes all of the necessary headers. Yes?

      Undefined references are caused by using something the compiler has neither seen declared not defined.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by weaknessforcats
        I assume some_text_file_ name includes all of the necessary headers. Yes?

        Undefined references are caused by using something the compiler has neither seen declared not defined.
        I'm afraid the OP is trying to compile and link each file separately.

        kind regards,

        Jos

        Comment

        Working...