Home > OS >  What do the following GCC flags mean?
What do the following GCC flags mean?

Time:12-10

What do the following GCC flags mean: -D_LNX64i, -I, -ldl -lm. I was asked to compile this file and the Internet is drawing a very scary blank

CodePudding user response:

GCC flags are described in the documentation of the compiler. The full GCC documentation is available online.

Alternatively, you can use the man g command to access the man-page which is an abbreviated manual for the command. This also works for other programs, libraries, shell commands. Man-pages are also available online.

Internet is drawing a very scary blank

If you were searching literally -D_LNX64i -I -ldl -lm, then it's important for you to learn that prefixing a word with - will exclude pages that contain such word when using most search engines. This is counter productive when you want to find pages that do contain those words. That search would find nothing since you're only excluding search results. You have to add quotes around words that begin with -.

Furthermore, this is an opportunity to learn about common command line option patterns: Double dash such as --option is a long option that can usually be searched easily. Single dash such as -o is a short option. Due to their compact form, these are hard to find using search engines. It's best to go for the documentation or man-page directly.

Options may be followed by a value for the option. Long options are usually separated from the value using whitespace or =, but short options may be followed by the value immediately such as in the case of -D_LNX64i and -ldl. Many values such as these are often project specific and you won't find them in GCC documentation.

  • Related