1

I created a standalone executable using C++ and I want it to be usable by the largest number of people possible. In terms of compiler options what can I do to ensure this? I'm using MinGW with the linker option -static-libgcc -static-libstdc++. My probable users will be using Windows 7.

EDIT: I already made my source code as portable as I can. This webpage mentions the argument ANSI (-A) "for maximum portability". What affect does making it ANSI compatible have?

4

1 回答 1

-1

使用 g++,您可以使用很多警告标志。-Wall 已经有帮助了,但还有很多其他的,例如:

-Werror -Wall -Wextra -pedantic -std=gnu++0x -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Winit-self -Wlogical-op -Wmissing-include-dirs -Woverloaded-虚拟 -Wredundant-decls -Wshadow -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=1 -Wundef -Wno-unused -Wunused-variable -Wno-variadic-macros -Wno-括号 -Wno-unknown-pragmas - Wwrite-strings -Wswitch -fdiagnostics-show-option -Wnoexcept -Wold-style-cast -Wformat=2

它不会使您的代码与所有 C++ 编译器兼容,但是,一旦您尝试其他编译器,它将有助于减少必要的工作。

要查看所有这些警告标志,请查看 g++ 的手册页或信息页。

于 2013-05-26T03:03:37.433 回答