2012-01-24 2 views
2

poco 라이브러리에 암호화 패키지를 사용하고 있습니다./MT 오류로 poco C++ 라이브러리 정적 연결

PocoCryptomt.lib이 libeay32mt.lib 정적 VC하려면 ​​openssl 라이브러리를 구축

나는이 코드를 사용, PocoFoundationmt.lib

응용 프로그램은 릴리스/MT 내가 PocoCryptomt.lib 링크

#define POCO_STATIC 
#include <iostream> 
#include <Poco\Crypto\Cipher.h> 
#include <Poco\Crypto\CipherFactory.h> 
#include <Poco\Crypto\CipherKey.h> 
#include <string> 
using namespace std; 
using namespace Poco::Crypto; 
typedef std::vector<unsigned char> ByteVec; 
void main() 
{ 
unsigned char k[]={49, 17, 199, 69, 242, 178, 153, 25, 129, 86, 8, 125, 151, 171, 20, 162, 4, 247, 64, 221, 42, 57, 80, 69, 48, 164, 8, 34, 44, 24, 9, 90}; 
    unsigned char i[]={ 219, 157, 180, 130, 179, 204, 171, 242, 251, 112, 209, 173, 100, 219, 141, 179}; 

    ByteVec key= ByteVec(k,k+sizeof(k)/sizeof(unsigned char)); 
    ByteVec iv= ByteVec(i,i+sizeof(i)/sizeof(unsigned char)); 

    //CipherFactory& cf = CipherFactory::defaultFactory; 
    CipherFactory& cf = CipherFactory::defaultFactory(); 
    Cipher* c=cf.createCipher(CipherKey("aes-256",key,iv)); 
    string plain="Ahmed"; 
    string crypted=c->encryptString(plain,Cipher::ENC_BASE64); 
    string decrypted=c->decryptString(crypted,Cipher::ENC_BASE64); 
    cout<<plain<<endl<<crypted<<decrypted; 
    cout<<endl;system("PAUSE"); 
} 

나는 다음과 같은 오류를 얻을

1>------ Rebuild All started: Project: Encryption, Configuration: Release Win32 ------ 
1> Main.cpp 
1>PocoCryptomt.lib(CipherKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_get_cipherbyname 
1>PocoCryptomt.lib(CipherKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_flags 
1>PocoCryptomt.lib(CipherKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_BytesToKey 
1>PocoCryptomt.lib(CipherKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_md5 
1>PocoCryptomt.lib(CipherKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_key_length 
1>PocoCryptomt.lib(CipherKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_block_size 
1>PocoCryptomt.lib(CipherKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_iv_length 
1>PocoCryptomt.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol _ERR_error_string 
1>PocoCryptomt.lib(RSACipherImpl.obj) : error LNK2001: unresolved external symbol _ERR_error_string 
1>PocoCryptomt.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol _ERR_get_error 
1>PocoCryptomt.lib(RSACipherImpl.obj) : error LNK2001: unresolved external symbol _ERR_get_error 
1>PocoCryptomt.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol _EVP_CipherInit 
1>PocoCryptomt.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_CTX_cleanup 
1>PocoCryptomt.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol _EVP_CIPHER_CTX_block_size 
1>PocoCryptomt.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol _EVP_CipherUpdate 
1>PocoCryptomt.lib(CipherImpl.obj) : error LNK2001: unresolved external symbol _EVP_CipherFinal_ex 
1>PocoCryptomt.lib(RSACipherImpl.obj) : error LNK2001: unresolved external symbol _RSA_size 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _RSA_size 
1>PocoCryptomt.lib(RSACipherImpl.obj) : error LNK2001: unresolved external symbol _RSA_public_encrypt 
1>PocoCryptomt.lib(RSACipherImpl.obj) : error LNK2001: unresolved external symbol _RSA_private_decrypt 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _CRYPTO_set_dynlock_destroy_callback 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _CRYPTO_set_dynlock_lock_callback 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _CRYPTO_set_dynlock_create_callback 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _CRYPTO_set_locking_callback 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _CRYPTO_num_locks 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _RAND_seed 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _OPENSSL_add_all_algorithms_noconf 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _SSL_load_error_strings 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _SSL_library_init 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _OPENSSL_config 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _ERR_free_strings 
1>PocoCryptomt.lib(OpenSSLInitializer.obj) : error LNK2001: unresolved external symbol _EVP_cleanup 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_PKEY_get1_RSA 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _X509_get_pubkey 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BN_free 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _RSA_generate_key_ex 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BN_set_word 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BN_new 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _RSA_new 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_RSAPrivateKey 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BIO_free 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _PEM_read_bio_RSAPublicKey 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BIO_ctrl 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BIO_new 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BIO_s_file 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BIO_new_mem_buf 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _RSA_free 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_RSAPrivateKey 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _EVP_des_ede3_cbc 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _PEM_write_bio_RSAPublicKey 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BIO_s_mem 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BN_bn2bin 
1>PocoCryptomt.lib(RSAKeyImpl.obj) : error LNK2001: unresolved external symbol _BN_num_bits 
1>F:\WorkShop\c++\Win32\Encryption\Release\Encryption.exe : fatal error LNK1120: 50 unresolved externals 
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== 

이/MD, PocoCryptomd.lib, PocoFoundationmd.lib WH와 지느러미를 작동 이 문제를 해결하려면 어떻게해야합니까?

+1

이들은 openssl의 식별자입니다. 연결하지 않았거나 잘못된 맛을 가지고있는 것처럼 들립니다. –

답변

4

libeay32 [mt] .lib와 ssleay32 [mt] .lib를 연결해야합니다. 앨런 언급대로 ssleay32 [MT] .LIB 및 libeay32 [MT] lib 디렉토리를 추가 할 수 있습니다 Visual Studio에서

+0

이고 아마도 crypt32 일 수 있습니다. – nergeia

0

다음 단계를 사용

프로젝트를 마우스 오른쪽 단추로 클릭 ->속성를 선택 ->구성 속성 ->링커 ->입력 ->추가 종속성

라이브러리 이름을 입력하고 사전 또한

확인 SS, 이러한 정적 라이브러리에 대한 경로가 일반 확장 목록 항목에서

추가 라이브러리 디렉토리

링커에 있는지 확인합니다.

관련 문제