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?
command-line compiling c++
add a comment |
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?
command-line compiling c++
add a comment |
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?
command-line compiling c++
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++
command-line compiling c++
edited Nov 25 at 22:29
Rui F Ribeiro
38.3k1477127
38.3k1477127
asked May 24 '11 at 0:50
algorithmicCoder
20826
20826
add a comment |
add a comment |
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!
add a comment |
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
-Wallemit warnings on suspicious code (-Wallactually means important warnings only, not all possible warnings)
-I/usr/local/include/thriftlook in that directory for include files (#includedirectives)
*.cppcompile these files
-lthriftlink with this library (this searcheslibthrift.a). Note that-lmust come after the files you're compiling, because-lmeans “if there are any undefined symbols at this point, look for definitions in the specificed library”
-o somethingput the compiled and linked output into the specified file
add a comment |
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!
add a comment |
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!
add a comment |
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!
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!
answered May 24 '11 at 1:05
Mark Szymanski
62163
62163
add a comment |
add a comment |
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
-Wallemit warnings on suspicious code (-Wallactually means important warnings only, not all possible warnings)
-I/usr/local/include/thriftlook in that directory for include files (#includedirectives)
*.cppcompile these files
-lthriftlink with this library (this searcheslibthrift.a). Note that-lmust come after the files you're compiling, because-lmeans “if there are any undefined symbols at this point, look for definitions in the specificed library”
-o somethingput the compiled and linked output into the specified file
add a comment |
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
-Wallemit warnings on suspicious code (-Wallactually means important warnings only, not all possible warnings)
-I/usr/local/include/thriftlook in that directory for include files (#includedirectives)
*.cppcompile these files
-lthriftlink with this library (this searcheslibthrift.a). Note that-lmust come after the files you're compiling, because-lmeans “if there are any undefined symbols at this point, look for definitions in the specificed library”
-o somethingput the compiled and linked output into the specified file
add a comment |
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
-Wallemit warnings on suspicious code (-Wallactually means important warnings only, not all possible warnings)
-I/usr/local/include/thriftlook in that directory for include files (#includedirectives)
*.cppcompile these files
-lthriftlink with this library (this searcheslibthrift.a). Note that-lmust come after the files you're compiling, because-lmeans “if there are any undefined symbols at this point, look for definitions in the specificed library”
-o somethingput the compiled and linked output into the specified file
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
-Wallemit warnings on suspicious code (-Wallactually means important warnings only, not all possible warnings)
-I/usr/local/include/thriftlook in that directory for include files (#includedirectives)
*.cppcompile these files
-lthriftlink with this library (this searcheslibthrift.a). Note that-lmust come after the files you're compiling, because-lmeans “if there are any undefined symbols at this point, look for definitions in the specificed library”
-o somethingput the compiled and linked output into the specified file
answered May 24 '11 at 1:19
Gilles
523k12610441576
523k12610441576
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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