#Linking error in httpclient.

4 messages · Page 1 of 1 (latest)

grizzled oceanBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

sullen pewter
#
// httpclient.hpp
#ifndef HTTPCLIENT_HPP
#define HTTPCLIENT_HPP

#include <boost/asio.hpp>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using boost::asio::ip::tcp;
using boost::system::error_code;

namespace pancakes
{

    class httpclient
    {
        boost::asio::io_context& io_;        // I/O context for networking
        tcp::resolver resolver_;                // required for the endpoints
        tcp::socket socket_;                    // socket
        std::ofstream file_;                    // file output stream
        std::vector<char> buffer_;        // buffer for file output stream
        std::size_t buffer_size_;            // buffer size
        bool header_done_{ false };        // checks if the GET request reached its final header
        std::string request_;                    // request for http GET method
        std::string host_;                        // host for http GET method
        std::string header_accum_;        // accumulation for headers.

    public:
        httpclient(boost::asio::io_context& io, std::size_t buffer_size = 1024);
        void get(const std::string& host, const std::string& path, const std::string& filename);

    private:
        void connect(tcp::resolver::results_type endpoints);
        void request();
        void response();
    };
}

#endif
#

so far i been getting this linking error ```cpp
Severity Code Description Project File Line Suppression State Details
Error LNK2019 unresolved external symbol "public: void __cdecl pancakes::httpclient::get(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?get@httpclient@pancakes@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) referenced in function main Download C:\Users\Pancakes\Documents\C++\Project-V\ASIO\Download\main.obj 1