Dev-c++ Linux Debian

This brief tutorial explains how to compile and run C/C++ programs in GNU/Linux operating system. If you’re a student or a new Linux user coming from Microsoft platform, then you might be wondering how to run the C or C++ programs in a Linux distribution. Because, compiling and running code in Linux platforms is little bit different than Windows. Let us get started, shall we?

Jun 22, 2016 UPDATE Take a look at the Illustrated Guide to Monitoring and Tuning the Linux Networking Stack: Receiving Data, which adds some diagrams for the information presented below. This blog post will be examining the Linux kernel version 3.13.0 with links to code on GitHub and code snippets throughout this post.

  • Description of software in the Debian Linux distribution under maintenance of the Debian Games team. Displayed are packages of the C, C and D development category.
  • Get notifications on updates for this project. Get the SourceForge newsletter. Get newsletters and notices that include site news, special offers and exclusive discounts about IT products & services.
  • Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
  • Development files for International Components for Unicode. ICU is a C and C library that provides robust and full-featured Unicode and locale support.

Setup Development Environment

As you may already know, we need to install the necessary tools and compilers to run the code, right? Yes! Refer the following guide to install all development tools in your Linux box.

Linux mint download

The development tools includes all necessary applications, such as GNU GCC C/C++ compilers, make, debuggers, man pages and others which are needed to compile and build new software, packages etc.

Also, there is a script named ‘manji’ that helps you to setup a complete environment in Ubuntu-based systems.

After installing the necessary development tools, verify them using any one of the following commands:

These commands will display the installation path and version of gcc compiler.

Compile And Run C, C++ Programs In Linux

First, let us see how to compile and run a simple program written in C language.

Compile And Run C Programs

Write your code/program in your favorite CLI/GUI editor.

I am going to write my C program using nano editor.

Note: You need to use extension .c for C programs or .cpp for C++ programs.

Copy/paste the following code:

Press Ctrl+O and Ctrl+X to save and quit the file.

To compile the program, run:

Dev-c++ Linux Debian

Or,

If there are any syntax or semantic errors in your code/program, they will be displayed. You need to fix them first to proceed further. If there is no error then the compiler will successfully generate an executable file named ostechnix in the current working directory.

Finally, execute the program using command:

You will see an output like below:

To compile multiple source files (Eg. source1 and source2) into executable, run:

To allow warnings, debug symbols in the output:

To compile the source code into Assembler instructions:

To compile the source code without linking:

The above command will create a executable called source.o.

If your program contains math functions:

For more details, refer the man pages.

Compile And Run C++ Programs

Write your C++ program in any editor of your choice and save it with extension .cpp.

Here is a simple C++ program.

To compile this C++ program in Linux, simply run:

If there were no errors, you can run this C++ program under Linux using command:

Sample output would be:

Alternatively, we can compile the above C++ program using “make” command like below.

Did you notice? I didn’t use .cpp extension in the above command to compile the program. It is not necessary to use the extension to compile C++ programs using make command.

And run it using command:

For more details, refer man pages.

Hope this helps.

Thanks for stopping by!

Help us to help you:

Dev-c linux debian version
  • Subscribe to our Email Newsletter : Sign Up Now
  • Support OSTechNix : Donate Via PayPal
  • Download free E-Books and Videos : OSTechNix on TradePub
  • Connect with us: Reddit | Facebook | Twitter | LinkedIn|RSS feeds

Have a Good day!!

Share

Okay, just got into linux, and how does one go about doing C++ development in linux? Can one just use 'vi' to edit text, and then call the g++ compiler? Or does Debian come with a c++ environment? I did find a good IDE, Dev-C++ for linux, but it was made 5 years ago.

I would prefer t o use an IDE as opposed to going back to my roots ^_^ So if anyone knows any good ones (Open Source prefered), yeah, that would be great...

Debian Download

(I couldn't decide whether to put this in the linux forum or the C++ forum, so I just picked the closest I could get.)

  • 3 Contributors
  • forum 13 Replies
  • 216 Views
  • 1 Month Discussion Span
  • commentLatest Postby FireSBurnsmuPLatest Post

John A1,896

Oooh... many different ways of programming in Linux.

There's the bare-bones programming in Vi or some other text editor, and then compiling with gcc/g++. This is best for small projects, because anything larger, and the syntax becomes too complex.

Dev C++ For Debian

There are also LOTS of IDEs out there for Linux. You've already named one, Dev-C++, and although it's old, it's still perfectly good and works well. Another good one for Linux is '>Code::Blocks, which is similar to Dev-C++, except it's a more recent IDE. Then there's the good old KDevelop, which is designed for KDE, although it's possible to run it under Gnome, too.

Linux Ubuntu

Hope this helps