Thread: Some problem, help =)

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    2

    Some problem, help =)

    Hi All

    This is code:
    Code:
    #include </home/cross/c_coding/C_CkHttp.h>
    #include <stdio.h>
    
    void ChilkatSample(void)
        {
        HCkHttp http;
        BOOL success;
        const char * html;
    
        http = CkHttp_Create();
    
        success = CkHttp_UnlockComponent(http,"Anything for 30-day trial");
        if (success != TRUE) {
            printf("%s\n",CkHttp_lastErrorText(http));
            return;
        }
    
        html = CkHttp_quickGetStr(http,"http://yahoo.com/");
    
        printf("%s\n",html);
    
        CkHttp_Dispose(http);
    
        }
        
        main() 
        {
          ChilkatSample();       
        }
    And this is errors:
    Code:
    cross@iggy:~/c_coding$ gcc -o hi 1.c
    /tmp/ccg8Hgy8.o: In function `ChilkatSample':
    1.c:(.text+0x7): undefined reference to `CkHttp_Create'
    1.c:(.text+0x1d): undefined reference to `CkHttp_UnlockComponent'
    1.c:(.text+0x31): undefined reference to `CkHttp_lastErrorText'
    1.c:(.text+0x4e): undefined reference to `CkHttp_quickGetStr'
    1.c:(.text+0x67): undefined reference to `CkHttp_Dispose'
    collect2: ld returned 1 exit status
    cross@iggy:~/c_coding$
    Help me plz!

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Just listen to your compiler and link the appropriate library!
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    2
    link the appropriate library
    How?

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    I depends on what compiler you're using.
    Devoted my life to programming...

  5. #5
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    I suspect this is the problem

    Code:
    #include </home/cross/c_coding/C_CkHttp.h>
    Try this

    Code:
    #include "/home/cross/c_coding/C_CkHttp.h"

  6. #6
    Novice
    Join Date
    Jul 2009
    Posts
    568
    I believe that only changes where they are searched first; "include.h" will be first searched for in current directory and then in the include path, <include.h> will be searched for vice versa. This is also a linker error, not a compiler error, which leads me to believe that he ain't linking in the library, like Sipher pointed out.

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    The funny thing is he actually copied the command he used to compile it. For gcc, use -l followed by the library name. I have no idea what the library name is for this specific library, look it up on the documentation.

    But a prior poster was right that you should NOT use absolute filenames in an include statement. Just use the -I compiler flag to indicate where the compiler should look for it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM