Thread: help me : compiler is giving strange errors

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    16

    Unhappy help me : compiler is giving strange errors

    Hello
    i am using borlan c++ 5.02 on my laptop when i try to compile my following code

    // Acutall code
    Code:
    #include <C_CkMailMan.h>
    #include <C_CkEmail.h>
    #include <stdio.h>
    
    void main()
        {
        HCkMailMan mailman;
        BOOL success;
        HCkEmail email;
        const char * contentType;
    
        //  The mailman object is used for sending and receiving email.
        mailman = CkMailMan_Create();
    
        //  Any string argument automatically begins the 30-day trial.
    
        success = CkMailMan_UnlockComponent(mailman,"30-day trial");
        if (success != TRUE) {
            printf("Component unlock failed\n");
            return;
        }
    
        //  Set the SMTP server.
        CkMailMan_putSmtpHost(mailman,"smtp.chilkatsoft.com");
    
        //  You may need a login/password.  In many cases,
        //  authentication is not required when sending local email
        //  (i.e. to email addresses having the same domain as the
        //  SMTP server), but is required when sending to non-local
        //  recipients.
        CkMailMan_putSmtpUsername(mailman,"myLogin");
        CkMailMan_putSmtpPassword(mailman,"myPassword");
    
        //  Create a new email object
        email = CkEmail_Create();
    
        CkEmail_putSubject(email,"This is a test");
        CkEmail_putBody(email,"This is a test");
        CkEmail_putFrom(email,"Chilkat Support <[email protected]>");
        CkEmail_AddTo(email,"Somebody1","[email protected]");
        CkEmail_AddTo(email,"Somebody2","[email protected]");
    
        //  Add any number of attachments:
    
        //  The AddFileAttachment method can be called any number of times
        //  to add 1 or more attachments to an email.  It returns the
        //  content type of the attachment added.  This is for informational
        //  purposes only.  For example, if a .jpg file is attached,
        //  the return string will be "image/jpeg".
        //  If AddFileAttachment fails (perhaps by a file-not-found error),
        //  a NULL reference is returned:
        contentType = CkEmail_addFileAttachment(email,"c:/temp/something.doc");
        if (contentType == 0 ) {
            printf("%s\n",CkEmail_lastErrorText(email));
            return;
        }
    
        success = CkMailMan_SendEmail(mailman,email);
        if (success != TRUE) {
            printf("%s\n",CkMailMan_lastErrorText(mailman));
        }
        else {
            printf("Mail Sent!\n");
        }
    
    
        CkMailMan_Dispose(mailman);
        CkEmail_Dispose(email);
    
        }

    it gives me followig error. i got this expample code from [url=http://www.example-code.com]

    unresolver external '_main' referenced from C:\BC5\LIB\COX32.OBJ

    but when i change this to void main() it gives following 16 errors. please help me


    Info :Making...
    Info :mail.CPP: build due to .OBJ dependency mail.CPP
    Info : mail.CPP: cached age 1:57:25 PM 7/1/2011 file age 1:57:29 PM 7/1/2011
    Info :Compiling C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\mail.CPP
    Info :Linking C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\mail.exe
    Error: Error: Unresolved external 'CkMailMan_Create()' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkMailMan_UnlockComponent(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkMailMan_putSmtpHost(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkMailMan_putSmtpUsername(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkMailMan_putSmtpPassword(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_Create()' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_putSubject(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_putBody(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_putFrom(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_AddTo(void*,const char*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_addFileAttachment(void*,const char*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_lastErrorText(void*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkMailMan_SendEmail(void*,void*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkMailMan_lastErrorText(void*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkMailMan_Dispose(void*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ
    Error: Error: Unresolved external 'CkEmail_Dispose(void*)' referenced from C:\USERS\MEHAWK\DESKTOP\UPGRADING RECONAISSANCE\RECONAISSANCE 2.0\MAIL.OBJ

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Don't you want to ask this in the C++ forum?

  3. #3
    Registered User
    Join Date
    Jul 2011
    Posts
    16
    Quote Originally Posted by Adak View Post
    Don't you want to ask this in the C++ forum?
    No. i am saying that i used borland c++ compiler to compile this c example program. the reason i dont want to ask this in c++ because the code is in c.
    Last edited by mehawk1; 07-01-2011 at 08:07 AM.

  4. #4
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    Quote Originally Posted by mehawk1 View Post
    No. i am saying that i used borland c++ compiler to compile this c++ example program. the reson i dont want to ask this in c++ because the code is in c++.
    What?? This is the weirdest this i've ever come across. "this is c++ because the code is in C++". Does that really make any sense.

    Anyway have you got the library files for these two header files?
    #include <C_CkMailMan.h>
    #include <C_CkEmail.h>

    It seems like the there mainly function which cannot be referenced by the compiler.

    ssharish
    Life is like riding a bicycle. To keep your balance you must keep moving - Einstein

  5. #5
    Registered User
    Join Date
    Jul 2011
    Posts
    16
    Quote Originally Posted by ssharish2005 View Post
    What?? This is the weirdest this i've ever come across. "this is c++ because the code is in C++". Does that really make any sense.

    Anyway have you got the library files for these two header files?
    #include <C_CkMailMan.h>
    #include <C_CkEmail.h>

    It seems like the there mainly function which cannot be referenced by the compiler.

    ssharish
    the code is taken from c section not c++. it uses stdio.h not iostream.h and printf instead of cout. anyway yes i have all files but some the functions are not working and compiler is giving error

  6. #6
    Registered User
    Join Date
    Jul 2011
    Posts
    16
    i think the error is a little bit like type casting error. what do you think?

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Compile your code with a C compiler since it is C (you can also continue checking that it is probably valid C++ by compiling with a C++ compiler, but that's secondary). This probably won't solve the problem you have at hand, but it is a good step.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Registered User
    Join Date
    Jul 2011
    Posts
    16
    it send mail using smtp server and uses user name and password for the authentication

  9. #9
    Registered User
    Join Date
    Jul 2011
    Posts
    16
    can you name one because i use borland or dev. i dont hav c compiler.

  10. #10
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by mehawk1 View Post
    No. i am saying that i used borland c++ compiler to compile this c++ example program.
    And you posted about your c++ program on the C forum.
    Quote Originally Posted by mehawk1 View Post
    the reson i dont want to ask this in c++ because the code is in c++.
    The reason you don't want to ask on the C++ forum is because the code example is in C++?

    .cpp means c plus plus

    Now go away and show up on the right forum.


    Quzah.
    Hope is the first step on the road to disappointment.

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Moved.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  12. #12
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    You need to link in the Chilkat library you're trying to use. How do you do that? I don't know...I don't use ancient compilers/IDEs.

  13. #13
    Registered User
    Join Date
    Jul 2011
    Posts
    16
    @rags_to_riches

    actually i found a problem i have linked the the chikat library but somehow the library does not linked up properly.
    Last edited by mehawk1; 07-01-2011 at 08:06 AM.

  14. #14
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by mehawk1 View Post
    @rags_to_riches

    actually i found a problem i have linked the the chikat library but somehow the library does not linked up properly.
    from Chilkat C / C++ Libraries for EmbarcaderoŽ C++ BuilderŽ
    Only supports the v5.5 free command-line compiler.
    I suggest verifying the Library is compatible to your compiler.
    I suggest using a compiler that was made in this century.

    Edit: Added link to the C example code http://www.example-code.com/C/emailO...recipients.asp

    Note: You NEED to learn what a file extension is; using the file extension .cpp made everyone think you are writing c++ code. This is because most modern IDE only compile .c extension files as C programs.


    Tim S.
    Last edited by stahta01; 07-01-2011 at 02:00 PM. Reason: Added note on cpp and changed Compiler to IDE

  15. #15
    Registered User
    Join Date
    Jul 2011
    Posts
    16
    Quote Originally Posted by stahta01 View Post
    from Chilkat C / C++ Libraries for EmbarcaderoŽ C++ BuilderŽ


    I suggest verifying the Library is compatible to your compiler.
    I suggest using a compiler that was made in this century.

    Edit: Added link to the C example code C Email Recipients - AddTo, AddCC, AddBcc, AddMultipleTo, AddMultipleCC, AddMultipleBcc

    Note: You NEED to learn what a file extension is; using the file extension .cpp made everyone think you are writing c++ code. This is because most modern IDE only compile .c extension files as C programs.


    Tim S.
    The compiler is not compatible with chilkat library, now it is giving the error of uuid.lib that it is missing. Actually yesterday i was very busy in analyzing different codes on different compilers thats why i made too much mistakes in posts. I am not a new programmer i already know the differene between c and c++, i used to work in c and c++ and mostly in C++ envoirnment. Anyone who knows a little bit about c or c++ can easily tell that its a c program there is no confusion the code is very easy to understand. i also tried code::block but that was not compatible either so i gave up about working on that sample because each header file and the sample code contains a code that makes it trail that it can work up to 30 days that means i have to reprogram each and everything. i hav not got enough time to reprogram every thing. I am also using visual studio 2010 but i dont like it much . i like the old compilers . Thank you so much for your response and the link but now i am not going to use chilkat library because of its limitation.

    Mehroz Anjum

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program giving errors
    By andy bee in forum C Programming
    Replies: 5
    Last Post: 08-11-2010, 10:38 PM
  2. compiler giving me problem
    By babybo in forum C++ Programming
    Replies: 2
    Last Post: 03-25-2010, 12:54 AM
  3. my code is giving linking errors can anyone help!
    By wajeeha.javed in forum C++ Programming
    Replies: 7
    Last Post: 06-08-2007, 07:09 PM
  4. _splitpath giving me errors!
    By Kixdemp in forum C Programming
    Replies: 9
    Last Post: 06-10-2006, 03:21 AM
  5. CreateFile() giving errors
    By neandrake in forum Windows Programming
    Replies: 2
    Last Post: 09-27-2004, 10:29 PM