Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5933827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:01:42+00:00 2026-05-22T15:01:42+00:00

The following code using boost::asio will not compile: #ifndef _SERVER_H_ #define _SERVER_H_ #include Connection.h

  • 0

The following code using boost::asio will not compile:

    #ifndef _SERVER_H_
    #define _SERVER_H_

    #include "Connection.h"

    class Server
    {
    public:
      Server(boost::asio::io_service& io_service);

    private:
      void start_accept();

      void handle_accept(Connection::pointer new_connection,const boost::system::error_code& error);


      boost::asio::ip::tcp::acceptor acceptor_;
    };

    #endif
    -------------------------------------------------------------------------------------------------
    #include "Server.h"

    Server::Server(boost::asio::io_service& io_service)
        : acceptor_(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 9985)){
            start_accept();
    }

    void Server::start_accept(){

        Connection::pointer new_connection =
          Connection::create(acceptor_.io_service());

        acceptor_.async_accept(new_connection->socket(),
            boost::bind(&Server::handle_accept, this, new_connection,
              boost::asio::placeholders::error));
    }


    void Server::handle_accept(Connection::pointer new_connection,const boost::system::error_code& error){
        if (!error)
        {
          new_connection->start();
          start_accept();
        }
      }
--------------------------------------------------------------------------------------------------
#include <Server.h>
#include <iostream>


int main()
{
  try
  {
    boost::asio::io_service io_service;
    Server server1(io_service);
    io_service.run();
  }
  catch (std::exception& e)
  {
    std::cerr << e.what() << std::endl;
  }

  return 0;
}

This is the error it produces in Visual C++:

error LNK2019: unresolved external symbol "public: __thiscall Server::Server(class boost::asio::io_service &)" (??0Server@@QAE@AAVio_service@asio@boost@@@Z) referenced in function _main

What does this error mean?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:01:43+00:00Added an answer on May 22, 2026 at 3:01 pm

    This means that whatever source file you put Server‘s constructor definition into isn’t being compiled and/or linked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: #include <iostream> #include boost/unordered_map.hpp using namespace std; using namespace
Is the following code thread safe when using boost shared_ptr. Thanks! class CResource {
I wrote a small tcp client using boost::asio, providing the following function: typedef boost::function<void(const
In the following code, gcc does not instantiate the NSP::Admin and NSP::Server objects. It
Consider the following code. using boost::shared_ptr; struct B; struct A{ ~A() { std::cout <<
Following code shows that the parameter, passed by reference, is copied when using boost::bind.
I have the following code and it works fine. #include <boost\mpl\vector.hpp> #include <boost\mpl\fold.hpp> #include
The following code: #include <boost/variant.hpp> #include <iostream> #include <string> struct A { A() {
I'm trying to learn a little bit C++ and Boost.Asio. I'm trying to compile
I am trying to build a project using Boost's Asio and I am having

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.