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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:10:44+00:00 2026-06-03T11:10:44+00:00

I just started learning C++(coming from Java & Python) and am trying to learn

  • 0

I just started learning C++(coming from Java & Python) and am trying to learn how to use other libraries. I found some sample code(from the boost site) I wanted to run(below) but its giving me this error:

`Undefined symbols for architecture x86_64:
  "boost::gregorian::greg_month::get_month_map_ptr()", referenced from:
      unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::string const&) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)`

I think the code is solid(since its not produced by me 🙂 but I’m not sure the steps required to use another library. So far, I just added the #include but should I also be using a header file for this(I know how to use one when I create multiple files when I create them myself but unsure about external libraries).

I found a similar question ( using from_string with boost date ), that suggested I need to link it boost’s datatime, so I ran the command(changed filenames) and got this error:

`ld: library not found for -lboost_date_time
collect2: ld returned 1 exit status`

I think I installed boost correctly, I used Brew on the mac and saw it compile a bunch of files(it took like an hour to install). So if it is installed, What am I doing wrong(or not doing)?

Thanks

Here’s the code:

#include "boost/date_time/gregorian/gregorian.hpp"
#include <iostream>

int
main() 
{

    using namespace boost::gregorian;
    std::string s;
    std::cout << "Enter birth day YYYY-MM-DD (eg: 2002-02-01): ";
    std::cin >> s;
    try {
        date birthday(from_simple_string(s));
        date today = day_clock::local_day();
        days days_alive = today - birthday;
        days one_day(1);
        if (days_alive == one_day) {
            std::cout << "Born yesterday, very funny" << std::endl;
        }
        else if (days_alive < days(0)) {
            std::cout << "Not born yet, hmm: " << days_alive.days() 
            << " days" <<std::endl;
        }
        else {
            std::cout << "Days alive: " << days_alive.days() << std::endl;
        }

    }
    catch(...) {
        std::cout << "Bad date entered: " << s << std::endl;
    }
    return 0;
}
  • 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-03T11:10:45+00:00Added an answer on June 3, 2026 at 11:10 am

    The boost libraries generally have really funky names that include the build options and sometimes the version.

    On my system I might use -lboost_date_time-mgw45-d-1_47 to link to the library you mention.

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

Sidebar

Related Questions

I just started learning C++ (coming from Java ) and am having some serious
I just started learning Ruby coming from Java. In Java you would use packages
G'Day Programmers, I am from Java background however I have just started learning C++
I just started learning Java and I encountered some problems with the tag in
I have just started learning Python & have come across namespaces concept in Python.
I just started learning python and django and I have a question. I got
I´ve just started learning GWT and I´m trying to implement http://gwt.google.com/samples/Showcase/Showcase.html#!CwFileUpload and but failing
I just started learning Common Lisp a few days ago, and I'm trying to
Just started learning Rails (3). I am tearing my hair out trying to find
I just recently started learning RoR and found that Prototype.js is a default javascript

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.