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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:47:39+00:00 2026-06-13T08:47:39+00:00

Can somebody please explain the following: $ cat test.cpp #include <string> std::string div; $

  • 0

Can somebody please explain the following:

$ cat test.cpp 
#include <string>
std::string div;
$ g++ -c test.cpp 
$ g++ -std=c++11 -c test.cpp 
test.cpp:2:13: error: 'std::string div' redeclared as different kind of symbol
In file included from /usr/include/c++/4.7.1/cstdlib:66:0,
                 from /usr/include/c++/4.7.1/ext/string_conversions.h:37,
                 from /usr/include/c++/4.7.1/bits/basic_string.h:2814,
                 from /usr/include/c++/4.7.1/string:54,
                 from test.cpp:1:
/usr/include/stdlib.h:787:14: error: previous declaration of 'div_t div(int, int)'
$

Shouldn’t the div symbol be in std namespace also for C++11 mode? Or is it something specific to my system?

  • 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-13T08:47:39+00:00Added an answer on June 13, 2026 at 8:47 am

    /usr/include/stdlib.h

    Every name in a .h C stdlib header resides in the global namespace (obviously).

    Additionally, any cHEADER C++ stdlib header will define the corresponding names from HEADER.h in the std namespace, but is also allowed to have them in the global namespace (so they can just do

    // cHEADER
    #include <HEADER.h>
    
    namespace std{
    using ::one_name_from_HEADER;
    using ::another_name_from_HEADER;
    // and so on...
    }
    

    and be done with it).

    §D.5 [depr.c.headers]

    p2 Every C header, each of which has a name of the form name.h, behaves as if each name placed in the standard library namespace by the corresponding cname header is placed within the global namespace scope. It is unspecified whether these names are first declared or defined within namespace scope (3.3.6) of the namespace std and are then injected into the global namespace scope by explicit using-declarations (7.3.3).

    p3 [ Example: The header <cstdlib> assuredly provides its declarations and definitions within the namespace std. It may also provide these names within the global namespace. The header <stdlib.h> assuredly provides the same declarations and definitions within the global namespace, much as in the C Standard. It may also provide these names within the namespace std. —end example ]

    As you can see, the same is also true the other way around (<HEADER.h> may introduces names to the std namespace, as if

    // HEADER.h
    #include <cHEADER>
    
    using std::one_name_from_HEADER;
    using std::another_name_from_HEADER;
    // and so on...
    }
    

    ), which makes the whole distinction between those headers rather… useless, really.

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

Sidebar

Related Questions

Can somebody explain the following code please? #if 1 // loop type #define FOR_IS_FASTER
Can somebody please explain to me how to properly test Postgres DB errors, particularly
can somebody please explain what is the difference between the following mechanisms of passing
Can somebody please explain to me what the following is: parent.result.location Is it an
can somebody please explain me the difference between the following code snippets for filling
Can somebody please explain how to use macros in x86 assembly coding
Can somebody please explain how to find out if full text search is enabled
Can somebody please explain to me the meaning of this line of code? val
Can somebody please explain to me the difference between: Session.Add(name,txtName.text); and Session[name] = txtName.text;
Can somebody please tell me what is wrong with the following pom.xml? i'm getting

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.