1
    LIBS =   ws2_32.lib winmm.lib advapi32.lib  crypt32.lib user32.lib gdi32.lib   libeay32.lib ssleay32.lib 

OSCOMPAT = /DWIN32 /D_WIN32_WINNT=0x0400
VSCOMPAT = /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE  
CFLAGS= -I . -I$C /MT /W3 $(OSCOMPAT) $(VSCOMPAT) -nologo $(EXTRACFLAGS)

test: $(CCLIENTLIB) test.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj 
    LINK /NOLOGO mtest.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj  $(LIBS) 


test.obj:test.c 
oauth.obj: oauth.c
hash.obj: hash.c
oauth_http.obj: oauth.h oauth_http.c
xmalloc.obj: xmalloc.c

我收到以下错误

    LINK /NOLOGO test.obj oauth.obj hash.obj oauth_http.obj xmalloc.obj    ws2_32.lib winmm.lib advapi32.lib  crypt32.lib user32.lib gdi32.lib   libeay32.lib ssleay32.lib
hash.obj : error LNK2019: unresolved external symbol HMAC referenced in function oauth_sign_hmac_sha1_raw
hash.obj : error LNK2019: unresolved external symbol EVP_sha1 referenced in function oauth_sign_hmac_sha1_raw
hash.obj : error LNK2019: unresolved external symbol EVP_PKEY_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol CRYPTO_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_SignFinal referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestUpdate referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestInit referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_PKEY_size referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol BIO_free referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_PrivateKey referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol BIO_new_mem_buf referenced in function oauth_sign_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_MD_CTX_cleanup referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_VerifyFinal referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_PUBKEY referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol X509_free referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol X509_get_pubkey referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol PEM_read_bio_X509 referenced in function oauth_verify_rsa_sha1
hash.obj : error LNK2019: unresolved external symbol EVP_DigestFinal referenced in function oauth_body_hash_file
hash.obj : error LNK2019: unresolved external symbol EVP_MD_size referenced in function oauth_body_hash_file
hash.obj : error LNK2019: unresolved external symbol EVP_MD_CTX_init referenced in function oauth_body_hash_file
test.exe : fatal error LNK1120: 20 unresolved externals

make 文件有什么问题。 如何将 libssl 与我的应用程序链接?

你可以从这里下载代码 https://rapidshare.com/files/458792519/test.rar (它包括来自 liboauth 的代码)

4

1 回答 1

1

为了总结 OP 评论中的对话,我下载了示例代码并针对它运行了 nmake (makefile.nt)。我确实收到了链接器错误,但缺少的符号来自 Win32 库。我将 user32.lib 和 gdi32.lib 添加到 makefile 的 LIBS 列表中,然后干净地链接(该构建适用于 VS2005、VS2008 和 VS2010)。

As the OP points out, it also linked cleanly when adding those two additional libraries. It is not clear to me how that would help resolve those symbols from libeay32.lib. So my suspicion is that the change to the make file resulted in a full rebuild and compile of all .obj files. The full clean build resulted in it working. So maybe (I'm just guessing) the .obj files were compiled incorrectly originally (compiler that didn't work well with the linker perhaps?) and the full rebuild made everything consistent.

于 2011-04-28T13:13:00.920 回答