How do I compile a C/C++ program on Linux using the GNU gcc/g++ compiler?

Undefined

I am assuming you want the latest version of some software, which isn't available in Debians repository and you can't find any .deb package from other trusted sites.

Begin by installing the build-essential package:

sudo apt-get install build-essential

Press Enter.

These are the important library files for compiling C/C++ programs on linux.

Next step is to read the INSTALL-File or Readme file which comes with the software you want to compile, make sure all dependencies are installed before trying to compile the source code into a working program.


Writing your own first program under Linux using a simple texteditor and compiling it:

If you are starting to program in C/C++ and have just written your first standard hello world program and want to compile it.

The options -Wall -W and -Werror instructs the compiler to check for any warnings and the -o flag outputs it to an executable file.

g++ -Wall -W -Werror myfirstprogram.cpp -o hello

Press Enter.

Execute the program with the following command:

sudo ./hello

I do however recommend using CODE::BLOCKS IDE, which comes with the GNU gcc/g compiler.

You will find it under our software section.

Library categories: 

Games For Linux

Windows has always been the preferred platform for gaming, but after STEAM's interest in Linux more game developers are making their games natively available for Linux.

Disclaimer

All information on this website is published in good faith and for general educational purposes and for use in safe testing environments only. While linuxexperten.com strives to make the information on this site as accurate as possible, linuxexperten.com does not warrant its completeness, reliability and accuracy.

We are not responsible for any losses or damages associated with the use of our website. While we strive to provide only links to useful websites, we have no control over the content of these sites and links to other sites do not constitute a recommendation for all content contained on these websites.

 

Site Information

This is a professional review site that receives compensation from the companies whose products reviewed. Each service or product are thoroughly tested and given high marks if considered to be the very best. Independently owned and the opinions expressed here are no one elses.

 

Limited Time Offers

Coming soon...