Compiler version, name, and OS detection in C++

前端 未结 4 1452
感动是毒
感动是毒 2021-01-03 05:57

I need to detect the OS name, compiler name, and version of the compiler with C++, as I need to change the setup for each case.

How can I do that?

4条回答
  •  佛祖请我去吃肉
    2021-01-03 06:31

    Usually you leave that task to the build environment. Either using commands like uname if you can assume a posixy set up, or by any other mean which is deemed suitable.

提交回复
热议问题