• Advertisement
Sign in to follow this  

Compilling a program

This topic is 4799 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement