What does this Linux command do?











up vote
3
down vote

favorite












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


This is from the Apache Thrift website.



Also is the -I/usr supposed to be -I /usr?










share|improve this question




























    up vote
    3
    down vote

    favorite












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


    This is from the Apache Thrift website.



    Also is the -I/usr supposed to be -I /usr?










    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











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


      This is from the Apache Thrift website.



      Also is the -I/usr supposed to be -I /usr?










      share|improve this question















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


      This is from the Apache Thrift website.



      Also is the -I/usr supposed to be -I /usr?







      command-line compiling c++






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 at 22:29









      Rui F Ribeiro

      38.3k1477127




      38.3k1477127










      asked May 24 '11 at 0:50









      algorithmicCoder

      20826




      20826






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          8
          down vote



          accepted










          Here is a breakdown of the command. First the original command, for reference



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


          Now, for the breakdown.



          g++


          This is the actual command command, g++. It is the program that is being executed. Here is what it is, from the man page:




          gcc - GNU project C and C++ compiler




          This is a compiler for programs written in C++ and C. It takes C or C++ code and turns it into a program, basically.



          -Wall


          This part makes it display all warnings when compiling. (Warn All)



          -I/usr/local/include/thrift


          This part tells g++ to use /usr/local/include/thrift as the directory to get the header files from. And with the question about whether to put a space after the I or not. You can do it either way. The way the options (options are things in a command after - signs. -Wall and -I are options) are parsed allows you to put a space or not. It depends on your personal preference.



          *.cpp


          This part passes every .cpp file in the current directory to the g++ command.



          -lthrift


          This can also be -l thrift. It tells g++ to search the thrift library when linking.



          -o something


          This tells it that when everything is compiled to place the executable in the file something.



          I hope this helps and please comment if anything is unclear!






          share|improve this answer




























            up vote
            2
            down vote













            Generally you should look for the documentation of a command in its man page: man g++. In the case of GNU software such as GCC, you'll usually find more complete documentation in info format, or in HTML on the software home page.



            C (and C++) compilers have a somewhat peculiar syntax that doesn't heed the usual conventions for options (options come before operand, there's an optional space between an option and its argument, …). The space after -I is actually optional, but -Wall needs to be one word.



            Here's a quick overview of that command (look in the documentation for details):





            • g++ run a C++ compiler


            • -Wall emit warnings on suspicious code (-Wall actually means important warnings only, not all possible warnings)


            • -I/usr/local/include/thrift look in that directory for include files (#include directives)


            • *.cpp compile these files


            • -lthrift link with this library (this searches libthrift.a). Note that -l must come after the files you're compiling, because -l means “if there are any undefined symbols at this point, look for definitions in the specificed library”


            • -o something put the compiled and linked output into the specified file






            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "106"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f13682%2fwhat-does-this-linux-command-do%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              8
              down vote



              accepted










              Here is a breakdown of the command. First the original command, for reference



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


              Now, for the breakdown.



              g++


              This is the actual command command, g++. It is the program that is being executed. Here is what it is, from the man page:




              gcc - GNU project C and C++ compiler




              This is a compiler for programs written in C++ and C. It takes C or C++ code and turns it into a program, basically.



              -Wall


              This part makes it display all warnings when compiling. (Warn All)



              -I/usr/local/include/thrift


              This part tells g++ to use /usr/local/include/thrift as the directory to get the header files from. And with the question about whether to put a space after the I or not. You can do it either way. The way the options (options are things in a command after - signs. -Wall and -I are options) are parsed allows you to put a space or not. It depends on your personal preference.



              *.cpp


              This part passes every .cpp file in the current directory to the g++ command.



              -lthrift


              This can also be -l thrift. It tells g++ to search the thrift library when linking.



              -o something


              This tells it that when everything is compiled to place the executable in the file something.



              I hope this helps and please comment if anything is unclear!






              share|improve this answer

























                up vote
                8
                down vote



                accepted










                Here is a breakdown of the command. First the original command, for reference



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


                Now, for the breakdown.



                g++


                This is the actual command command, g++. It is the program that is being executed. Here is what it is, from the man page:




                gcc - GNU project C and C++ compiler




                This is a compiler for programs written in C++ and C. It takes C or C++ code and turns it into a program, basically.



                -Wall


                This part makes it display all warnings when compiling. (Warn All)



                -I/usr/local/include/thrift


                This part tells g++ to use /usr/local/include/thrift as the directory to get the header files from. And with the question about whether to put a space after the I or not. You can do it either way. The way the options (options are things in a command after - signs. -Wall and -I are options) are parsed allows you to put a space or not. It depends on your personal preference.



                *.cpp


                This part passes every .cpp file in the current directory to the g++ command.



                -lthrift


                This can also be -l thrift. It tells g++ to search the thrift library when linking.



                -o something


                This tells it that when everything is compiled to place the executable in the file something.



                I hope this helps and please comment if anything is unclear!






                share|improve this answer























                  up vote
                  8
                  down vote



                  accepted







                  up vote
                  8
                  down vote



                  accepted






                  Here is a breakdown of the command. First the original command, for reference



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


                  Now, for the breakdown.



                  g++


                  This is the actual command command, g++. It is the program that is being executed. Here is what it is, from the man page:




                  gcc - GNU project C and C++ compiler




                  This is a compiler for programs written in C++ and C. It takes C or C++ code and turns it into a program, basically.



                  -Wall


                  This part makes it display all warnings when compiling. (Warn All)



                  -I/usr/local/include/thrift


                  This part tells g++ to use /usr/local/include/thrift as the directory to get the header files from. And with the question about whether to put a space after the I or not. You can do it either way. The way the options (options are things in a command after - signs. -Wall and -I are options) are parsed allows you to put a space or not. It depends on your personal preference.



                  *.cpp


                  This part passes every .cpp file in the current directory to the g++ command.



                  -lthrift


                  This can also be -l thrift. It tells g++ to search the thrift library when linking.



                  -o something


                  This tells it that when everything is compiled to place the executable in the file something.



                  I hope this helps and please comment if anything is unclear!






                  share|improve this answer












                  Here is a breakdown of the command. First the original command, for reference



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


                  Now, for the breakdown.



                  g++


                  This is the actual command command, g++. It is the program that is being executed. Here is what it is, from the man page:




                  gcc - GNU project C and C++ compiler




                  This is a compiler for programs written in C++ and C. It takes C or C++ code and turns it into a program, basically.



                  -Wall


                  This part makes it display all warnings when compiling. (Warn All)



                  -I/usr/local/include/thrift


                  This part tells g++ to use /usr/local/include/thrift as the directory to get the header files from. And with the question about whether to put a space after the I or not. You can do it either way. The way the options (options are things in a command after - signs. -Wall and -I are options) are parsed allows you to put a space or not. It depends on your personal preference.



                  *.cpp


                  This part passes every .cpp file in the current directory to the g++ command.



                  -lthrift


                  This can also be -l thrift. It tells g++ to search the thrift library when linking.



                  -o something


                  This tells it that when everything is compiled to place the executable in the file something.



                  I hope this helps and please comment if anything is unclear!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 24 '11 at 1:05









                  Mark Szymanski

                  62163




                  62163
























                      up vote
                      2
                      down vote













                      Generally you should look for the documentation of a command in its man page: man g++. In the case of GNU software such as GCC, you'll usually find more complete documentation in info format, or in HTML on the software home page.



                      C (and C++) compilers have a somewhat peculiar syntax that doesn't heed the usual conventions for options (options come before operand, there's an optional space between an option and its argument, …). The space after -I is actually optional, but -Wall needs to be one word.



                      Here's a quick overview of that command (look in the documentation for details):





                      • g++ run a C++ compiler


                      • -Wall emit warnings on suspicious code (-Wall actually means important warnings only, not all possible warnings)


                      • -I/usr/local/include/thrift look in that directory for include files (#include directives)


                      • *.cpp compile these files


                      • -lthrift link with this library (this searches libthrift.a). Note that -l must come after the files you're compiling, because -l means “if there are any undefined symbols at this point, look for definitions in the specificed library”


                      • -o something put the compiled and linked output into the specified file






                      share|improve this answer

























                        up vote
                        2
                        down vote













                        Generally you should look for the documentation of a command in its man page: man g++. In the case of GNU software such as GCC, you'll usually find more complete documentation in info format, or in HTML on the software home page.



                        C (and C++) compilers have a somewhat peculiar syntax that doesn't heed the usual conventions for options (options come before operand, there's an optional space between an option and its argument, …). The space after -I is actually optional, but -Wall needs to be one word.



                        Here's a quick overview of that command (look in the documentation for details):





                        • g++ run a C++ compiler


                        • -Wall emit warnings on suspicious code (-Wall actually means important warnings only, not all possible warnings)


                        • -I/usr/local/include/thrift look in that directory for include files (#include directives)


                        • *.cpp compile these files


                        • -lthrift link with this library (this searches libthrift.a). Note that -l must come after the files you're compiling, because -l means “if there are any undefined symbols at this point, look for definitions in the specificed library”


                        • -o something put the compiled and linked output into the specified file






                        share|improve this answer























                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          Generally you should look for the documentation of a command in its man page: man g++. In the case of GNU software such as GCC, you'll usually find more complete documentation in info format, or in HTML on the software home page.



                          C (and C++) compilers have a somewhat peculiar syntax that doesn't heed the usual conventions for options (options come before operand, there's an optional space between an option and its argument, …). The space after -I is actually optional, but -Wall needs to be one word.



                          Here's a quick overview of that command (look in the documentation for details):





                          • g++ run a C++ compiler


                          • -Wall emit warnings on suspicious code (-Wall actually means important warnings only, not all possible warnings)


                          • -I/usr/local/include/thrift look in that directory for include files (#include directives)


                          • *.cpp compile these files


                          • -lthrift link with this library (this searches libthrift.a). Note that -l must come after the files you're compiling, because -l means “if there are any undefined symbols at this point, look for definitions in the specificed library”


                          • -o something put the compiled and linked output into the specified file






                          share|improve this answer












                          Generally you should look for the documentation of a command in its man page: man g++. In the case of GNU software such as GCC, you'll usually find more complete documentation in info format, or in HTML on the software home page.



                          C (and C++) compilers have a somewhat peculiar syntax that doesn't heed the usual conventions for options (options come before operand, there's an optional space between an option and its argument, …). The space after -I is actually optional, but -Wall needs to be one word.



                          Here's a quick overview of that command (look in the documentation for details):





                          • g++ run a C++ compiler


                          • -Wall emit warnings on suspicious code (-Wall actually means important warnings only, not all possible warnings)


                          • -I/usr/local/include/thrift look in that directory for include files (#include directives)


                          • *.cpp compile these files


                          • -lthrift link with this library (this searches libthrift.a). Note that -l must come after the files you're compiling, because -l means “if there are any undefined symbols at this point, look for definitions in the specificed library”


                          • -o something put the compiled and linked output into the specified file







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered May 24 '11 at 1:19









                          Gilles

                          523k12610441576




                          523k12610441576






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Unix & Linux Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f13682%2fwhat-does-this-linux-command-do%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              List directoties down one level, excluding some named directories and files

                              list processes belonging to a network namespace

                              list systemd RuntimeDirectory mounts