strdup error on g++ with c++0x

前端 未结 4 1205
情书的邮戳
情书的邮戳 2020-12-17 00:25

I have some C++0x code. I was able to reproduce it below. The code below works fine without -std=c++0x however i need it for my real code.

How do i incl

4条回答
  •  一整个雨季
    2020-12-17 01:00

    -std=gnu++0x (instead of -std=c++0x) does the trick for me; -D_GNU_SOURCE didn't work (I tried with a cross-compiler, but perhaps it works with other kinds of g++).

    It appears that the default (no -std=... passed) is "GNU C++" and not "strict standard C++", so the flag for "don't change anything except for upgrading to C++11" is -std=gnu++0x, not -std=c++0x; the latter means "upgrade to C++11 and be stricter than by default".

提交回复
热议问题