Im trying to compile a simple main to test Botan. It inits the library and generates a rsa key using the entropy source, but the linking is failing. Without the entropy it compiles just fine.
Error 15 error LNK2001: unresolved external symbol "public: virtual void __cdecl Botan::Win32_EntropySource::poll(class Botan::Entropy_Accumulator &)" (?poll@Win32_EntropySource@Botan@@UEAAXAEAVEntropy_Accumulator@2@@Z) C:\Fuentes\workspace\BotanTest\BotanTest\main.obj BotanTest
#include <botan/botan.h>
#include <botan/rsa.h>
#include <botan/x509cert.h>
#include <botan/x509self.h>
#include <botan/internal/es_win32.h>
#include <boost/foreach.hpp>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char** argv)
{
try
{
Botan::LibraryInitializer init;
cout << "Hello Botan!" << endl;
std::cout << "Generate key.." << std::endl;
Botan::AutoSeeded_RNG rng;
Botan::Win32_EntropySource entropySource;
rng.add_entropy_source(&entropySource);
//rng.reseed(10096);
Botan::RSA_PrivateKey rsaPrivate(rng, 1024);
Botan::MemoryVector<Botan::byte> publicBytes = Botan::X509::BER_encode(rsaPrivate);
Botan::MemoryVector<Botan::byte> privateBytes = Botan::PKCS8::BER_encode(rsaPrivate, rng, "passphrase");
cout << publicBytes.size() << endl;
cout << privateBytes.size() << endl;
}
catch(std::exception& e)
{
std::cerr << "Error: " << e.what() << "\n";
}
return 0;
}
Im compiling everything in x64, but tha same errors occurs in 32bits . Here's the linking line:
/OUT:"C:\Fuentes\workspace\BotanTest\BotanTest\x64\Release\BotanTest.exe" /MANIFEST /LTCG /NXCOMPAT /PDB:"C:\Fuentes\workspace\BotanTest\BotanTest\x64\Release\BotanTest.pdb" /DYNAMICBASE "botan.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /OPT:REF /PGD:"C:\Fuentes\workspace\BotanTest\BotanTest\x64\Release\BotanTest.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\BotanTest.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
could it be because of user32.lib? is there a user64.lib? Not reallt sure what is going on, because commenting the entropy line, make everything compile and work as expected.
thanks!
Aucun commentaire:
Enregistrer un commentaire