SHARE
TWEET

GCC/G++ Useful Flags

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