IMAP anyone?

I've written programs that use normal windows socketing (just Winsock) for SMTP. Coding them was relatively easy and straight forward. IMAP has been a different story.

I'm trying to access a gmail account on the imap.gmail.com server via SSL. I downloaded OpenSSL and successfully accessed my inbox by command line. I attempted use OpenSSL in my C++ application to connect and ended up with linker errors. Siiiiiiiigh the linker errors...I've properly linked the headers and libs...tried every configuration for Visual Studio 10.0 I could find from hours of reading every tutorial, source code example or problem thread I could find and haven't even been able to start coding my client yet.

I've tried ChilKat (which I don't intend on paying for) and VMIME as well as OpenSSL and haven't gotten anything to work.

If anyone has experience with C++ IMAP sessions please let me know which API comes with the least hassle (and is free) or any decent tutorial/thread that will help me out and won't take a bunch of tedious configuration.

Thanks.
* Can the compiler find the .libs?
* Do the .libs export C or C++ symbols?
* Are the headers C++-compatible?
* Are the .libs built for some particular configuration? .libs made for release are sometimes incompatible with debug builds, and vice versa.
* Are you getting conflicts from symbols defined in separate modules? If so, have you tried omitting standard libraries?
* Post your errors.
The compiler can find the libs. I think you're right about the lib files being generated for different build configs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>

int main()
{
   CRYPTO_malloc_init();

   SSL_library_init();

   SSL_load_error_strings();

   ERR_load_BIO_strings();

   OpenSSL_add_all_algorithms();

   return 0;
}


All headers included properly, functions are recognized. Linker errors:
1
2
3
4
5
1>main.obj : error LNK2019: unresolved external symbol _OPENSSL_add_all_algorithms_noconf referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _ERR_load_BIO_strings referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _SSL_library_init referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _CRYPTO_set_mem_functions referenced in function _main


I think I've compiled OpenSSL incorrectly, I get an error when running the instructed command "nmake -f ms\ntdll.mak":

1
2
3
4
5
6
.\crypto\cryptlib.c(168) : error C2078: too many initializers
.\crypto\cryptlib.c(171) : fatal error C1189: #error :  "Inconsistency between c
rypto.h and cryptlib.c"
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\cl.EXE"' : return code '0x2'
Stop. 
Topic archived. No new replies allowed.