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 7788633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:03:41+00:00 2026-06-01T21:03:41+00:00

I have a very simple example program that I am trying to compile, but

  • 0

I have a very simple example program that I am trying to compile, but I’m getting linking errors.

Program

int main()
{
  boost::asio::io_service io;

  boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
  t.wait();

  std::cout << "Hello, world!\n";

  return 0;
}

Compilation

I’m using the following compile options:

g++ -L/usr/lib -lboost_system -lboost_filesystem -lboost_thread -pthread -I/usr/include timer.cpp -o timer

Output

I’ve checked that the dynamic libraries exist and are located in the -L path. Here are the errors I’m getting:

/tmp/cc3hJrVk.o: In function `__static_initialization_and_destruction_0(int, int)':
timer.cpp:(.text+0xf0): undefined reference to `boost::system::generic_category()'
timer.cpp:(.text+0xfc): undefined reference to `boost::system::generic_category()'
timer.cpp:(.text+0x108): undefined reference to `boost::system::system_category()'
/tmp/cc3hJrVk.o: In function `boost::system::error_code::error_code()':
timer.cpp:(.text._ZN5boost6system10error_codeC2Ev[_ZN5boost6system10error_codeC5Ev]+0x17): undefined reference to `boost::system::system_category()'
/tmp/cc3hJrVk.o: In function `boost::asio::error::get_system_category()':
timer.cpp:(.text._ZN5boost4asio5error19get_system_categoryEv[boost::asio::error::get_system_category()]+0x5): undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status

As you can see, it seems like the bugs are something you’d get if you’re improperly linking to libboost_system. I have two separate installs of boost that I’ve tested against, and I’m at my wit’s end.

Thanks in advance for any help!

  • 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-06-01T21:03:42+00:00Added an answer on June 1, 2026 at 9:03 pm

    You need to move all your libraries after the file names, at the end of the command.

    Also: Boost::System must be built separately from the normal boost libraries. So if you haven’t built them separately they won’t exist.

    See section 3 here:

    http://www.boost.org/doc/libs/1_49_0/more/getting_started/unix-variants.html

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

Sidebar

Related Questions

Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I have this very simple example that I am using to learn structs in
Below I have a very simple example of what I'm trying to do. I
So I have a very simple program that reads the 3 first bytes of
Take a very simple case as an example, say I have this URL: http://www.example.com/65167.html
i have very simple problem. I need to create model, that represent element of
There is very simple task I want to do, that somehow makes the program
I'm trying Guice. I made a simple example which is very similar to the
So I'm working on creating a very simple C program that just preforms shell
I have been asked to write a (very) simple program for a set of

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.