Upgrading to C++17 — error: ‘__BEGIN_NAMESPACE_STD’ does not name a typehow to enable __BEGIN_NAMESPACE_STD in stdlib.hWhat does the explicit keyword mean?Do the parentheses after the type name make a difference with new?Compiling C++11 with g++error while working with boost::sregex_token_iteratorDoes std::vector<Object> reserve method need a copy constructor for Object class?Invalid use of incomplete type struct std::hash with unordered_map with std::pair of enum class as keyWhat are the new features in C++17?Compiler requesting c++17 support to be enabled for std::variant by using the -std++17 flag when -std=c++17 is in compiler outputSetup Clang on Travis CI for C++17How to fix overloading operands +?

Can the Supreme Court overturn an impeachment?

What's the difference between 違法 and 不法?

How to color a curve

Can a significant change in incentives void an employment contract?

How do I extrude a face to a single vertex

Did arcade monitors have same pixel aspect ratio as TV sets?

Drawing a topological "handle" with Tikz

How will losing mobility of one hand affect my career as a programmer?

How to align and center standalone amsmath equations?

Find last 3 digits of this monster number

Do Legal Documents Require Signing In Standard Pen Colors?

Is camera lens focus an exact point or a range?

THT: What is a squared annular “ring”?

Do the concepts of IP address and network interface not belong to the same layer?

Should I install hardwood flooring or cabinets first?

Difference between -| and |- in TikZ

What is this type of notehead called?

Translation of Scottish 16th century church stained glass

Some numbers are more equivalent than others

Why has "pence" been used in this sentence, not "pences"?

How can "mimic phobia" be cured or prevented?

Can I sign legal documents with a smiley face?

When quoting, must I also copy hyphens used to divide words that continue on the next line?

Is there a word to describe the feeling of being transfixed out of horror?



Upgrading to C++17 — error: ‘__BEGIN_NAMESPACE_STD’ does not name a type


how to enable __BEGIN_NAMESPACE_STD in stdlib.hWhat does the explicit keyword mean?Do the parentheses after the type name make a difference with new?Compiling C++11 with g++error while working with boost::sregex_token_iteratorDoes std::vector<Object> reserve method need a copy constructor for Object class?Invalid use of incomplete type struct std::hash with unordered_map with std::pair of enum class as keyWhat are the new features in C++17?Compiler requesting c++17 support to be enabled for std::variant by using the -std++17 flag when -std=c++17 is in compiler outputSetup Clang on Travis CI for C++17How to fix overloading operands +?













6















I'm trying to upgrade an application to C++17 and am getting the following compiler error:



error: ‘__BEGIN_NAMESPACE_STD’ does not name a type


I'm using gcc (GCC) 8.2.0 and compiling with the following command:



g++ -std=c++17 variant.cpp -o variant


Here's a small test program:



#include <iostream>
#include <variant>

using v_t = std::variant<int, double>;

int main(int argc, char const* argv[])

v_t foo = 5;
printf("foo contains %dn", *std::get_if<int>(&foo));

std::cout << "Success" << std::endl;
return 0;



And here's the error I get (below). Note that how to enable __BEGIN_NAMESPACE_STD in stdlib.h discusses a similar issue but the proposed solution (include C++ headers, not C headers such as stdlib.h) is something I'm already doing.



I am able to get this code compiling on my OSX laptop, possibly because I have a newer libc installed by default. However, when I run on my linux machine I get these errors. On the Linux machine, I am using the following linker/glibc version: ldd (Ubuntu EGLIBC 2.19-0ubuntu6.14) 2.19



I'm continuing to debug this but would appreciate any pointers in the right direction.



In file included from /toolchains/gcc-8.2.0/include/c++/8.2.0/cstdlib:75,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ext/string_conversions.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/basic_string.h:6391,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/string:52,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/locale_classes.h:40,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/ios_base.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ios:42,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ostream:38,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/iostream:39,
from variant.cpp:1:
/usr/include/stdlib.h:95:1: error: ‘__BEGIN_NAMESPACE_STD’ does not name a type
__BEGIN_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:101:5: error: ‘div_t’ does not name a type; did you mean ‘pid_t’?
} div_t;
^~~~~
pid_t
/usr/include/stdlib.h:112:1: error: ‘__END_NAMESPACE_STD’ does not name a type
__END_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:121:5: error: ‘lldiv_t’ does not name a type; did you mean ‘ldiv_t’?
} lldiv_t;
^~~~~~~









share|improve this question



















  • 3





    This is not about libc, but libstdc++. Presumably the alternative toolchain was not installed correctly or correctly activated, and installed headers leak into the compilation. Check the use of your -I or -isystem flags. It could also be helpful to look at g++ -E output to determine which files were included from where.

    – Florian Weimer
    Mar 21 at 13:49











  • Thanks, @FlorianWeimer -- you are correct. This was an issue with a broken gcc build. I recompiled from scratch and everything just worked.

    – Kulluk007
    Mar 21 at 15:31















6















I'm trying to upgrade an application to C++17 and am getting the following compiler error:



error: ‘__BEGIN_NAMESPACE_STD’ does not name a type


I'm using gcc (GCC) 8.2.0 and compiling with the following command:



g++ -std=c++17 variant.cpp -o variant


Here's a small test program:



#include <iostream>
#include <variant>

using v_t = std::variant<int, double>;

int main(int argc, char const* argv[])

v_t foo = 5;
printf("foo contains %dn", *std::get_if<int>(&foo));

std::cout << "Success" << std::endl;
return 0;



And here's the error I get (below). Note that how to enable __BEGIN_NAMESPACE_STD in stdlib.h discusses a similar issue but the proposed solution (include C++ headers, not C headers such as stdlib.h) is something I'm already doing.



I am able to get this code compiling on my OSX laptop, possibly because I have a newer libc installed by default. However, when I run on my linux machine I get these errors. On the Linux machine, I am using the following linker/glibc version: ldd (Ubuntu EGLIBC 2.19-0ubuntu6.14) 2.19



I'm continuing to debug this but would appreciate any pointers in the right direction.



In file included from /toolchains/gcc-8.2.0/include/c++/8.2.0/cstdlib:75,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ext/string_conversions.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/basic_string.h:6391,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/string:52,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/locale_classes.h:40,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/ios_base.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ios:42,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ostream:38,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/iostream:39,
from variant.cpp:1:
/usr/include/stdlib.h:95:1: error: ‘__BEGIN_NAMESPACE_STD’ does not name a type
__BEGIN_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:101:5: error: ‘div_t’ does not name a type; did you mean ‘pid_t’?
} div_t;
^~~~~
pid_t
/usr/include/stdlib.h:112:1: error: ‘__END_NAMESPACE_STD’ does not name a type
__END_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:121:5: error: ‘lldiv_t’ does not name a type; did you mean ‘ldiv_t’?
} lldiv_t;
^~~~~~~









share|improve this question



















  • 3





    This is not about libc, but libstdc++. Presumably the alternative toolchain was not installed correctly or correctly activated, and installed headers leak into the compilation. Check the use of your -I or -isystem flags. It could also be helpful to look at g++ -E output to determine which files were included from where.

    – Florian Weimer
    Mar 21 at 13:49











  • Thanks, @FlorianWeimer -- you are correct. This was an issue with a broken gcc build. I recompiled from scratch and everything just worked.

    – Kulluk007
    Mar 21 at 15:31













6












6








6








I'm trying to upgrade an application to C++17 and am getting the following compiler error:



error: ‘__BEGIN_NAMESPACE_STD’ does not name a type


I'm using gcc (GCC) 8.2.0 and compiling with the following command:



g++ -std=c++17 variant.cpp -o variant


Here's a small test program:



#include <iostream>
#include <variant>

using v_t = std::variant<int, double>;

int main(int argc, char const* argv[])

v_t foo = 5;
printf("foo contains %dn", *std::get_if<int>(&foo));

std::cout << "Success" << std::endl;
return 0;



And here's the error I get (below). Note that how to enable __BEGIN_NAMESPACE_STD in stdlib.h discusses a similar issue but the proposed solution (include C++ headers, not C headers such as stdlib.h) is something I'm already doing.



I am able to get this code compiling on my OSX laptop, possibly because I have a newer libc installed by default. However, when I run on my linux machine I get these errors. On the Linux machine, I am using the following linker/glibc version: ldd (Ubuntu EGLIBC 2.19-0ubuntu6.14) 2.19



I'm continuing to debug this but would appreciate any pointers in the right direction.



In file included from /toolchains/gcc-8.2.0/include/c++/8.2.0/cstdlib:75,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ext/string_conversions.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/basic_string.h:6391,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/string:52,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/locale_classes.h:40,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/ios_base.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ios:42,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ostream:38,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/iostream:39,
from variant.cpp:1:
/usr/include/stdlib.h:95:1: error: ‘__BEGIN_NAMESPACE_STD’ does not name a type
__BEGIN_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:101:5: error: ‘div_t’ does not name a type; did you mean ‘pid_t’?
} div_t;
^~~~~
pid_t
/usr/include/stdlib.h:112:1: error: ‘__END_NAMESPACE_STD’ does not name a type
__END_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:121:5: error: ‘lldiv_t’ does not name a type; did you mean ‘ldiv_t’?
} lldiv_t;
^~~~~~~









share|improve this question
















I'm trying to upgrade an application to C++17 and am getting the following compiler error:



error: ‘__BEGIN_NAMESPACE_STD’ does not name a type


I'm using gcc (GCC) 8.2.0 and compiling with the following command:



g++ -std=c++17 variant.cpp -o variant


Here's a small test program:



#include <iostream>
#include <variant>

using v_t = std::variant<int, double>;

int main(int argc, char const* argv[])

v_t foo = 5;
printf("foo contains %dn", *std::get_if<int>(&foo));

std::cout << "Success" << std::endl;
return 0;



And here's the error I get (below). Note that how to enable __BEGIN_NAMESPACE_STD in stdlib.h discusses a similar issue but the proposed solution (include C++ headers, not C headers such as stdlib.h) is something I'm already doing.



I am able to get this code compiling on my OSX laptop, possibly because I have a newer libc installed by default. However, when I run on my linux machine I get these errors. On the Linux machine, I am using the following linker/glibc version: ldd (Ubuntu EGLIBC 2.19-0ubuntu6.14) 2.19



I'm continuing to debug this but would appreciate any pointers in the right direction.



In file included from /toolchains/gcc-8.2.0/include/c++/8.2.0/cstdlib:75,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ext/string_conversions.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/basic_string.h:6391,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/string:52,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/locale_classes.h:40,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/bits/ios_base.h:41,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ios:42,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/ostream:38,
from /toolchains/gcc-8.2.0/include/c++/8.2.0/iostream:39,
from variant.cpp:1:
/usr/include/stdlib.h:95:1: error: ‘__BEGIN_NAMESPACE_STD’ does not name a type
__BEGIN_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:101:5: error: ‘div_t’ does not name a type; did you mean ‘pid_t’?
} div_t;
^~~~~
pid_t
/usr/include/stdlib.h:112:1: error: ‘__END_NAMESPACE_STD’ does not name a type
__END_NAMESPACE_STD
^~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:121:5: error: ‘lldiv_t’ does not name a type; did you mean ‘ldiv_t’?
} lldiv_t;
^~~~~~~






c++ c++17 libstdc++






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 13:47









Florian Weimer

17.9k31148




17.9k31148










asked Mar 21 at 13:43









Kulluk007Kulluk007

151213




151213







  • 3





    This is not about libc, but libstdc++. Presumably the alternative toolchain was not installed correctly or correctly activated, and installed headers leak into the compilation. Check the use of your -I or -isystem flags. It could also be helpful to look at g++ -E output to determine which files were included from where.

    – Florian Weimer
    Mar 21 at 13:49











  • Thanks, @FlorianWeimer -- you are correct. This was an issue with a broken gcc build. I recompiled from scratch and everything just worked.

    – Kulluk007
    Mar 21 at 15:31












  • 3





    This is not about libc, but libstdc++. Presumably the alternative toolchain was not installed correctly or correctly activated, and installed headers leak into the compilation. Check the use of your -I or -isystem flags. It could also be helpful to look at g++ -E output to determine which files were included from where.

    – Florian Weimer
    Mar 21 at 13:49











  • Thanks, @FlorianWeimer -- you are correct. This was an issue with a broken gcc build. I recompiled from scratch and everything just worked.

    – Kulluk007
    Mar 21 at 15:31







3




3





This is not about libc, but libstdc++. Presumably the alternative toolchain was not installed correctly or correctly activated, and installed headers leak into the compilation. Check the use of your -I or -isystem flags. It could also be helpful to look at g++ -E output to determine which files were included from where.

– Florian Weimer
Mar 21 at 13:49





This is not about libc, but libstdc++. Presumably the alternative toolchain was not installed correctly or correctly activated, and installed headers leak into the compilation. Check the use of your -I or -isystem flags. It could also be helpful to look at g++ -E output to determine which files were included from where.

– Florian Weimer
Mar 21 at 13:49













Thanks, @FlorianWeimer -- you are correct. This was an issue with a broken gcc build. I recompiled from scratch and everything just worked.

– Kulluk007
Mar 21 at 15:31





Thanks, @FlorianWeimer -- you are correct. This was an issue with a broken gcc build. I recompiled from scratch and everything just worked.

– Kulluk007
Mar 21 at 15:31












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281832%2fupgrading-to-c17-error-begin-namespace-std-does-not-name-a-type%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281832%2fupgrading-to-c17-error-begin-namespace-std-does-not-name-a-type%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현