GCC/G++ Useful Flags
MartyEhYT Feb 21st, 2019 (edited) 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- //some flags you can use
- -Werror = treat all warnings as errors
- -Wall = log all warnings to the console. Example: it'll tell you if you have unused variables
- -fpermissive = allows some non conforming code to compile. Only use if you know what you are doing.
- -g = turn on debugging. Console output is more friendly.
- -I <include path> = specify an include directory //need this for OpenGl, SFML, SDL, etc
- -L <library path> = specify a lib directory //need this for library's like OpenGl, SFML, SDL, etc
- -l<library link option> = flags to pass to the linker. Depends on API. For OpenGL, its -lGL
- -m64 = compile for the x86_64 architecture(64bit)
- -m32 = compile for the x86 architecture(32bit)
- -03 = optimizes code. Results in longer compile times, but faster execution and smaller file size.
- -S = Stop after the stage of compilation proper; do not assemble. The output is in the form of an assembler code
- -mwindows = disables the console
- -std=c++<version number> = sets the C++ language version
- -o <location> = output the application to a custom location
- -c = compile or assemble the source files, but do not link
- -v = print all the commands the compiler calls when compiling & linking
RAW Paste Data