Compilling a program
I am having troble compilling hello world in linux
Do I need to use a another cammand first such as
make
could some one please show me all the cammands needed to make a binary from source tahnks.
If your C source is: hello.c
you can compile it to a binary like this: gcc -o hello hello.c
If your source is C++: hello.cc (or .cxx)
compile it like this: g++ -o hello hello.cc
You don't need to call make unless you have a file called "Makefile" under your source tree. If you have the "Makefile", then only thing you need to do is call "make". It will do everything else for you (or not, read the README and INSTALL files commonly found at the root of the source tree)
Usually software is compiled using GNU Autotools.. that is, you have a configure script under the source tree (and few others).
In this case you will have to do following:
./configure
make
make install
"configure", well it configures the software (installation path and such..)
"make" compiles the software
"make install" copies the binaries and data files to locations that configure determined.
you can compile it to a binary like this: gcc -o hello hello.c
If your source is C++: hello.cc (or .cxx)
compile it like this: g++ -o hello hello.cc
You don't need to call make unless you have a file called "Makefile" under your source tree. If you have the "Makefile", then only thing you need to do is call "make". It will do everything else for you (or not, read the README and INSTALL files commonly found at the root of the source tree)
Usually software is compiled using GNU Autotools.. that is, you have a configure script under the source tree (and few others).
In this case you will have to do following:
./configure
make
make install
"configure", well it configures the software (installation path and such..)
"make" compiles the software
"make install" copies the binaries and data files to locations that configure determined.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement