본문 바로가기

카테고리 없음

How To Run Program In Dev C++



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?

How to write and compile C programs. In order to run a program and see it doing wonderful things, you should first write the program.The program can be written in any text editor, such as vi and emacs in Unix environment and using command prompt in DOS. Programming with the Dev C IDE 1 Introduction to the IDE Dev-C is a full-featured Integrated Development Environment (IDE) for the C/C programming language. As similar IDEs, it offers to the programmer a simple and unified tool to edit, compile, link, and debug programs. It also provides support for the management of the. If you are using your own computer, you can save the program wherever you want; however, you should consider creating a folder to hold all of your C.S.1318 programming assignments. If you are using a shared lab machine, you are only able to save your program in the My Documents folder.

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.

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:

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: Studio one 4.

To allow warnings, debug symbols in the output:

Chef Auto Repair Services at 4456 Chef Menteur Hwy was recently discovered under New Orleans, LA auto tune up. German Auto Repair Inc ( 1 reviews ) 1444 Manhattan Boulevard Harvey, LA 70058 (504) 368-1272. German Auto Repair Inc at 1444 Manhattan Boulevard was recently discovered under Harvey Lexus NX car tune up. Auto Tune Up in Mid-City on YP.com. See reviews, photos, directions, phone numbers and more for the best Automotive Tune Up Service in Mid-City, New Orleans, LA. Our New Orleans car repair and maintenance professionals are certified in service consulting, engine repair, electrical systems, and more. You can trust our team to thoroughly evaluate your car’s condition. Mitey Automotive Center at 3530 Jefferson Highway was recently discovered under New Orleans Land Rover Discovery auto tune up. New orleans auto tune up services.

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:

How to run program in dev c pdf

How To Run Program In Dev C++ 5.11

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.

How To Run A C Program In Dev C

Hope this helps.

Thanks for stopping by!

Help us to help you:

  • 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

How To Run Program In Dev C++ 4.9.9.2

Have a Good day!!

How To Run Graphics Program In Dev C++

Share