What does this Linux command do?

g++ -Wall -I/usr/local/include/thrift *.cpp -lthrift -o something

This is from the Apache Thrift internet site.

Additionally is the - I/usr intended to be - I/ usr?

0
2019-12-02 03:09:07
Source Share
Answers: 2

Generally you need to seek the documents of a command in its man page : man g++. When it comes to GNU software program such as GCC, you'll generally locate even more full documents in info format, or in HTML on the software home page.

C (and also C+npls) compilers have a rather strange syntax that does not note the common conventions for alternatives (alternatives come prior to operand, there is an optional room in between an alternative and also its argument, ). The room after -I is in fact optional, yet -Wall requires to be one word.

Below is a fast review of that command (search in the documents for information) :

  • g++ run a C+npls compiler
  • -Wall send out cautions on dubious code (-Wall in fact suggests vital cautions just, not all feasible cautions)
  • -I/usr/local/include/thrift search in that directory site for include files (#include instructions)
  • *.cpp compile these files
  • -lthrift relate to this collection (this searches libthrift.a). Keep in mind that -l has to follow the files you are compiling, due to the fact that -l suggests "if there are any kind of undefined icons now, seek interpretations in the specificed collection"
  • -o something placed the assembled and also connected result right into the defined documents
0
2019-12-03 05:03:59
Source

Here is a failure of the command. First the initial command, for reference

g++ -Wall -I/usr/local/include/thrift *.cpp -lthrift -o something

Now, for the failure.

g++

This is the real command command, g++. It is the program that is being implemented. Below is what it is, from the male web page :

gcc - GNU task C and also C+npls compiler

This is a compiler for programs created in C+npls and also C. It takes C or C+npls code and also transforms it right into a program, primarily.

-Wall

This component makes it present all cautions when compiling. (Warn All)

-I/usr/local/include/thrift

This component informs g++ to make use of /usr/local/include/thrift as the directory site to get the header documents from. And also with the inquiry concerning whether to place a room after the I or otherwise. You can do it regardless. The means the alternatives (alternatives are points in a command after - indicators. -Wall and also -I are alternatives) are analyzed permits you to place a room or otherwise. It relies on your individual choice.

*.cpp

This component passes every .cpp documents in the existing directory site to the g++ command.

-lthrift

This can additionally be -l thrift. It informs g++ to look the thrift collection when connecting.

-o something

This informs it that when every little thing is assembled to position the executable in the documents something.

0
2019-12-03 04:59:42
Source