Oct 07, 2019 This is used to compile and run C code. A compiler is a special program that processes statements written in a particular programming language like C and turns them into machine language or 'code' that a computer's processor uses. I actually wrote this article because I had a C assignment which required using a compiler. However, you can still use the advanced command line arguments in the configuration to set those switches. In other words, you can use a C11 compliant compiler with Dev-C, it's just not as easy as point and click out of the box. I agree that a newer IDE should be used, but some people like Dev-C too much to dump it. Running Dev-C blreichenau For programming assignments that include one file (e.g. Prog1.cpp): Start Dev-C. Double click the shortcut on the desktop or; from the Start button: Open a new source file. (You could use the Compile command followed by the Run command. These compilers can create both 32bit and 64bit executables and generally ship with much more Microsoft related headers and libraries. When you place these compilers in Dev-CppMinGW64, Dev-C can automatically configure them on first launch or via Tools Compiler Options Find Compilers.
00000 | 10011110 |
00000 | 10011110 |
00001 | 11110100 |
00010 | 10011110 |
00011 | 11010100 |
00100 | 10111111 |
00101 | 00000000 |
IDE | Platform | Console programs |
---|---|---|
Code::blocks | Windows/Linux/MacOS | Compile console programs using Code::blocks |
Visual Studio Express | Windows | Compile console programs using VS Express 2013 |
Dev-C++ | Windows | Compile console programs using Dev-C++ |
Compiler | Platform | Command |
---|---|---|
GCC | Linux, among others.. | g++ -std=c++0x example.cpp -o example_program |
Clang | OS X, among others.. | clang++ -std=c++11 -stdlib=libc++ example.cpp -o example_program |
Index | Next: Structure of a program |
What is Dev-C++?
Dev-C++, developed by Bloodshed Software, is a fully featured graphical IDE (Integrated Development Environment), which is able to create Windows or console-based C/C++ programs using the MinGW compiler system. MinGW (Minimalist GNU* for Windows) uses GCC (the GNU g++ compiler collection), which is essentially the same compiler system that is in Cygwin (the unix environment program for Windows) and most versions of Linux. There are, however, differences between Cygwin and MinGW; link to Differences between Cygwin and MinGW for more information.
Bloodshed!?
I'll be the first to say that the name Bloodshed won't give you warm and fuzzies, but I think it's best if the creator of Bloodshed explains:
There's also a reason why I keep the Bloodshed name. I don't want people to think Bloodshed is a company, because it isn't. I'm just doing this to help people.
Here is a good remark on the Bloodshed name I received from JohnS:
I assumed that this was a reference to the time and effort it requires of you to make these nice software programs, a la 'Blood, Sweat and Tears'.
Peace and freedom,
Colin Laplace
Getting Dev-C++
The author has released Dev-C++ as free software (under GPL) but also offers a CD for purchase which can contain all Bloodshed software (it's customizable), including Dev-C++ with all updates/patches.
Link to Bloodshed Dev-C++ for a list of Dev-C++ download sites.
You should let the installer put Dev-C++ in the default directory of C:Dev-Cpp, as it will make it easier to later install add-ons or upgrades.
Using Dev-C++
This section is probably why you are here.
All programming done for CSCI-2025 will require separate compilation projects (i.e. class header file(s), class implementation file(s) and a main/application/client/driver file). This process is relatively easy as long as you know what Dev-C++ requires to do this. In this page you will be given instructions using the Project menu choice. In another handout you will be given instructions on how to manually compile, link and execute C++ files at the command prompt of a command window. See here.
Step 1: Configure Dev-C++.
We need to modify one of the default settings to allow you to use the debugger with your programs.
Step 2: Create a new project.
A 'project' can be considered as a container that is used to store all the elements that are required to compile a program.
Step 3: Create/add source file(s).
You can add empty source files one of two ways:
EXAMPLE: Multiple source files In this example, more than 3 files are required to compile the program; The 'driver.cpp' file references 'Deque.h' (which requires 'Deque.cpp') and 'Deque.cpp' references 'Queue.h' (which requires 'Queue.cpp'). |
Step 4: Compile.
Once you have entered all of your source code, you are ready to compile.
It is likely that you will get some kind of compiler or linker error the first time you attempt to compile a project. Syntax errors will be displayed in the 'Compiler' tab at the bottom of the screen. You can double-click on any error to take you to the place in the source code where it occurred. The 'Linker' tab will flash if there are any linker errors. Linker errors are generally the result of syntax errors not allowing one of the files to compile.
Step 5: Execute.
You can now run your program.
Such incoming traffic can be “safe”; for example, instant messages from a friend, visits to Web pages you’ve published using Web Sharing, or your own file-sharing connections when you’re away from your desk. But other incoming connection attempts may be unwanted, and that’s what a firewall is designed to protect against.By contrast, most outbound network connections originate with software running on your computer, such as when you send e-mail or an instant message, when you visit a Web site, or when you print a document to a shared printer.If all outbound connections were so obvious, there’d be no cause for concern, but more and more software is designed to quietly make outgoing connections without our knowledge. With (; $25), Objective Development has delivered a worthy successor, with more-informative alerts to the user, more ways of seeing what traffic is coming from your Mac, and more pre-configured rules for common types of network traffic.As with Tiger (Mac OS X 10.4), the firewall software Apple provides with Leopard (Mac OS X 10.5) is designed to screen incoming network traffic—attempts to access your computer over its network ports. In a world with more and more concerns about privacy, not to mention worries about malware and viruses, many of us prefer to make our own decisions about what outgoing connections are OK, rather than have them made for us.Enter Little Snitch, which watches for outgoing network connections and clears them with the user before allowing them to proceed. What is little snitch on mac. The built-in firewall monitored, and blocked, only incoming network traffic, and Little Snitch was one of the available options for dealing with outbound network traffic.
Disappearing windows
If you execute your program (with or without parameters), you may notice something peculiar; a console window will pop up, flash some text and disappear. The problem is that, if directly executed, console program windows close after the program exits. You can solve this problem one of two ways:
system('Pause');
/* Scaffolding code for testing purposes */This will give you a chance to view any output before the program terminates and the window closes.
cin.ignore(256, 'n');
cout << 'Press ENTER to continue..'<< endl;
cin.get();
/* End Scaffolding */
For what it's worth, I use the command-line method.
Step 6: Debug.
When things aren't happening the way you planned, a source-level debugger can be a great tool in determining what really is going on. Dev-C++'s basic debugger functions are controlled via the 'Debug' tab at the bottom of the screen; more advanced functions are available in the 'Debug' menu.
Using the debugger:
The various features of the debugger are pretty obvious. Click the 'Run to cursor' icon to run your program and pause at the current source code cursor location; Click 'Next Step' to step through the code; Click 'Add Watch' to monitor variables.
Setting breakpoints is as easy as clicking in the black space next to the line in the source code.
See the Dev-C++ help topic 'Debugging Your Program' for more information.
Dev-C++ User F.A.Q.
Why do I keep getting errors about 'cout', 'cin', and 'endl' being undeclared?
It has to do with namespaces. You need to add the following line after the includes of your implementation (.cpp) files:
How do I use the C++ string class?
Again, it probably has to do with namespaces. First of all, make sure you '#include <string>' (not string.h). Next, make sure you add 'using namespace std;' after your includes.
Example:
That's it for now.Happy coding!