Error when using #include "Poco/Base64Encoder.h" in C++

82 Views Asked by At

I want to use base64 in the poco library to encode content in the file. The error I have encountering, LNK2019, indicates that the linker is unable to find the implementation of the Poco::Base64Encoder constructor. How can I add Poco base64 to do that?

#include "Poco/Base64Encoder.h"
#include "Poco/StreamCopier.h"
#include <sstream>
#include <iomanip>
#include <ctime>

void EncodeFileToBase64(const std::string& filePath, std::string& encodedContent) {
    std::ifstream fileStream(filePath, std::ios::binary);
    std::stringstream buffer;
    buffer << fileStream.rdbuf();

    Poco::Base64Encoder base64Encoder(buffer);
    Poco::StreamCopier::copyStream(buffer, base64Encoder);
    base64Encoder.close();

    encodedContent = buffer.str();
}

1

There are 1 best solutions below

0
Alex On

You should build POCO Foundation library and link with it.