1

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();
}

2
  • 2
    You need to link with the library - including the header is not enough. Commented Dec 8, 2023 at 14:54
  • 2
    Exactly the same code in another question? Commented Dec 8, 2023 at 14:57

1 Answer 1

0

You should build POCO Foundation library and link with it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.