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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:39:07+00:00 2026-06-01T13:39:07+00:00

I am using the new libcxx library and I have a code that calls

  • 0

I am using the new libcxx library and I have a code that calls the socket function bind(). The problem is that when I type using namespace std; the compiler gives me an error for the following code:

int res = bind(sockfd, (struct sockaddr *)&myAddr, sizeof(myAddr));

The error using clang (svn build):

error: no viable conversion from '__bind<int &, sockaddr *, unsigned long>' to 'int'
 int res = bind(sockfd, (struct sockaddr *)&myAddr, sizeof(myAddr));

I think that the problem is that using namespace std; brings the function std::bind() from the header <functional> to the scope (although the header is not included). As I am using a third party library that uses the entire namespace std I can’t easily change the class names to fully qualified names.

I was wondering whether this is a problem in the implementation of the library or whether there are some new rules in C++11 that might potentially break an old code that uses bind(). Any thoughts on this would be appreciated.

Thanks

Roman

  • 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-01T13:39:09+00:00Added an answer on June 1, 2026 at 1:39 pm

    This isn’t a problem in the implementation of the libraries. C++11 introduced its own std::bind function into namespace std, which is used to bind parameters to functions and support a bit of higher-order programming.

    The reason for having namespace std is to help prevent new library functions and classes from causing breaking changes in existing code. The reason for this is that everything has a name starting with std::, which prevents name collisions.

    However, if you write using namespace std; in your program, you’re exposing yourself to potential breaking changes like this one, since the free function bind and the function std::bind can’t necessarily be disambiguated.

    To fix this, you can call bind as ::bind to make clear that it’s in the global namespace, or you can remove the using namespace std; at the top of the program.

    Hope this helps!

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

Sidebar

Related Questions

I created a CultureInfo object using new CultureInfo(fr-FR). Now I have a number that
I have this code: FileDownloadHandler handler = new FileDownloadHandler(fileName); Browser.AddDialogHandler(handler); //using (new UseDialogOnce(Browser.DialogWatcher, handler))
I have a class A that allocates memory in its constructor using new .
What i think is that dynamic type means dynamically allocated object using new .
I have a question about using new[] . Imagine this: Object.SomeProperty = new[] {string1,
The following line of code is causing me an Exception using (new INVU.API.CallContextStore()) {
Can I call constructor explicitly, without using new , if I already have a
Considering the code below: How is the str1 object created without using new String()
I have three methods: public void Save<T>(T entity) { using (new Transaction()) { Session.Save(entity);
I am using few library functions that return a pointer created either using malloc

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.