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

  • Home
  • SEARCH
  • 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 658613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:57:11+00:00 2026-05-13T22:57:11+00:00

My project contains shared library and exe client. I found that my own exception

  • 0

My project contains shared library and exe client. I found that my own exception class thrown from the library is not caught by client catch block, and program terminates with “terminate called after throwing an instance of …” message. Continuing to play with the project, I found that any exception of any type is not caught. For example, this catch doesn’t work:

    try
    {
        m_pSerialPort = new boost::asio::serial_port(m_IoService, "non-existing-port");
    }
    catch(const boost::system::system_error& e)
    {
        // ...
    }

Error message:

terminate called after throwing an instance of 
'boost::exception_detail::clone_impl
<boost::exception_detail::error_info_injector
<boost::system::system_error> >'
  what():  No such file or directory

GCC version is 4.4.1, Linux OS. The same code is running successfully in Windows, MSVC.
What reason can prevent GCC program to catch exceptions properly?

  • 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-13T22:57:12+00:00Added an answer on May 13, 2026 at 10:57 pm

    Both the client .exe and the shared library should to be linked with libgcc in order to throw across shared library boundaries. Per the GCC manual:

    … if a library or main executable is supposed to throw or catch exceptions, you must link it using the G++ or GCJ driver, as appropriate for the languages used in the program, or using the option -shared-libgcc, such that it is linked with the shared libgcc.

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

Sidebar

Related Questions

We have a project that contains a library of Python and Scala packages, as
I have a project that contains xml files. I also have an Ant build
I have composite project which contains: C++ library for Linux/Windows, C++/CLI library based on
I have a maven project that contains a certain api I need to use
I've not found anything that addresses my specific name space question as yet. I
When you clone an eclipse project from a repository, project's build path contains errors
My project uses a static library from an external supplier, libext.a . The library
Project layout: /project_a /shared /project_b /shared /shared project_a and project_b both need to contain
my project contains navigation controller and segmented control (with separate view controller: segmentManagingViewController) programmatically
My embedded project contains a Qt application for the PC which is mainly a

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.