我经常构建C(和C++)代码,使用打开-Wall标志的GCC (或clang)。现在,我碰巧需要确保一个小的C项目,它在Linux上使用此标志构建得很好,也可以在Windows上使用MSVC构建。但是,如果我使用-Wall运行MSVC,我会得到许多我认为相当虚假的警告,例如:
warning C4255: 'some_func': no function prototype given: converting现在,我意识到我可以用#pragma
下面是代码:在上,GCC 10.1和Clang 10 (连同-Wall -Wextra -pedantic-errors -std=c++20)都拒绝编译。GCC:error: ISO C++ forbids declaration of 'main' with no type [-Wpedantic]但是在我的本地机器上,MinGW <