How can I make C++0x and __STRICT_ANSI__ get along?

后端 未结 3 1319
春和景丽
春和景丽 2020-12-29 05:16

I need to use popen in a project, but I get:

error: \'popen\' was not declared in this scope

It looks like GCC defines __STRICT_ANSI__

3条回答
  •  太阳男子
    2020-12-29 05:25

    I'm simply undefining it on the commandline right away, this is not terribly "clean" but it works fine from what I can tell.

    -std=gnu++0x -U__STRICT_ANSI__
    

    There is probably a good reason why one should not do that, but it gives me what I want (C++0x plus GNU extensions, plus legacy stuff still works). I've been doing this for a long time and never run into trouble. But don't blame me if it eats your cat.

提交回复
热议问题