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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:15:23+00:00 2026-05-23T19:15:23+00:00

I just installed the boost library on Linux and written a sample application :

  • 0

I just installed the boost library on Linux and written a sample application :

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

int main()
{
  std::string ds("2002-JAN-01");
  boost::gregorian::date d(boost::gregorian::from_string(ds));
  std::cout<< boost::gregorian::to_simple_string(d) <<std::endl;
  std::cout<< d<<std::endl;
}

I am compiling it as

gcc -I /home/test/code/thirdParty/boost_1_46_1/ -L /home/test/code/thirdParty/boost_1_46_1/stage/lib/ test.cpp

but getting lots of error as:

/tmp/ccAfgB8z.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0xd3): undefined reference to `std::ios_base::Init::Init()'
test.cpp:(.text+0xec): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0xf8): undefined reference to `boost::system::generic_category()'
test.cpp:(.text+0x104): undefined reference to `boost::system::system_category()'
/tmp/ccAfgB8z.o: In function `__tcf_4':
test.cpp:(.text+0x2be): undefined reference to `std::ios_base::Init::~Init()'
/tmp/ccAfgB8z.o: In function `main':
test.cpp:(.text+0x2d5): undefined reference to `std::allocator<char>::allocator()'
test.cpp:(.text+0x2e7): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
test.cpp:(.text+0x2f0): undefined reference to `std::allocator<char>::~allocator()'
test.cpp:(.text+0x2fd): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
test.cpp:(.text+0x316): undefined reference to `std::allocator<char>::~allocator()'
test.cpp:(.text+0x33e): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
test.cpp:(.text+0x357): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
test.cpp:(.text+0x379): undefined reference to `std::cout'
test.cpp:(.text+0x37e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
test.cpp:(.text+0x386): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
test.cpp:(.text+0x38b): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
test.cpp:(.text+0x394): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
test.cpp:(.text+0x3ad): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
test.cpp:(.text+0x3c2): undefined reference to `std::cout'
test.cpp:(.text+0x3cf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
test.cpp:(.text+0x3d4): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
test.cpp:(.text+0x418): undefined reference to `std::locale::locale()'
test.cpp:(.text+0x431): undefined reference to `std::locale::~locale()'
test.cpp:(.text+0x43d): undefined reference to `std::cout'
test.cpp:(.text+0x442): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
test.cpp:(.text+0x462): undefined reference to `std::locale::~locale()'
test.cpp:(.text+0x470): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'

Anyone have any idea?
In normal compilation i don’t use any std library in the command line option.

  • 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-23T19:15:23+00:00Added an answer on May 23, 2026 at 7:15 pm

    You need to compile C++ code with g++, not gcc.

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

Sidebar

Related Questions

I have boost installed under /home/username/local/include . I want to compile a library with
I have just installed boost for the first time on my Intel Mac, and
I just installed boost 1.42.0 from macports using sudo port install boost . Everything
im just installing the boost library using an installer. Its asking me which variants
I just built and installed boost on cygwin and was trying to compile a
I just built and installed boost_1_47_0 using the following on cygwin ./bootstrap.sh --with-libraries=chrono,date_time,exception,filesystem,graph,graph_parallel,iostreams,math,program_options,random,serialization,signals,system,test,thread,wave link=static
I just installed Boost on my machine. I'm working with the Visual Studio 2010
I just downloaded and ran the boost installer for version 1.42 (from boostpro.com), and
Just installed the latest SDK for iPhone 2.1. When I go to File ->
Just installed AnkhSVN and I see the equivalent of svn up but I'd prefer

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.