-->
This step-by-step walkthrough shows how to create a static library (.lib file) for use with C++ apps. Using a static library is a great way to reuse code. Rather than reimplementing the same routines in every app that requires the functionality, you write them one time in a static library and then reference it from the apps. Code linked from a static library becomes part of your app—you don't have to install another file to use the code.
This walkthrough covers these tasks:
'Fundamentals of Programming C', written by Richard L. Halterman, is free to read online and also available in pdf format. C GUI Programming with Qt4 2nd Edition December 18, 2011. Argument constructor (required to create arrays) if the class has no constructors. Constructors, assignment, and destructors do not inherit.
Prerequisites
An understanding of the fundamentals of the C++ language.
Create a static library project
The instructions for how to create the project vary depending on your version of Visual Studio. To see the documentation for your preferred version of Visual Studio, use the Version selector control. It's found at the top of the table of contents on this page.
To create a static library project in Visual Studio 2019
On the menu bar, choose File > New > Project to open the Create a New Project dialog box.
At the top of the dialog, set Language to C++, set Platform to Windows, and set Project type to Library.
From the filtered list of project types, select Windows Desktop Wizard, then choose Next.
In the Configure your new project page, enter MathLibrary in the Project name box to specify a name for the project. Enter StaticMath in the Solution name box. Choose the Create button to open the Windows Desktop Project dialog.
In the Windows Desktop Project dialog, under Application type, select Static Library (.lib).
Under Additional options, uncheck the Precompiled header check box if it's checked. Check the Empty project box.
Choose OK to create the project.
To create a static library project in Visual Studio 2017
On the menu bar, choose File > New > Project.
In the New Project dialog box, select Installed > Visual C++ > Windows Desktop. In the center pane, select Windows Desktop Wizard.
Specify a name for the project—for example, MathLibrary—in the Name box. Specify a name for the solution—for example, StaticMath—in the Solution Name box. Choose the OK button.
In the Windows Desktop Project dialog, under Application type, select Static Library (.lib).
Under Additional Options, uncheck the Precompiled header check box if it's checked. Check the Empty project box.
Choose OK to create the project.
To create a static library project in Visual Studio 2015
Dev-c 2b 2b To Create Pdfs
On the menu bar, choose File > New > Project.
In the New Project dialog box, select Installed > Templates > Visual C++ > Win32. In the center pane, select Win32 Console Application.
Specify a name for the project—for example, MathLibrary—in the Name box. Specify a name for the solution—for example, StaticMath—in the Solution Name box. Choose the OK button.
In the Win32 Application Wizard, choose Next.
In the Application Settings page, under Application type, select Static library. Under Additional options, uncheck the Precompiled header checkbox. Choose Finish to create the project.
Add a class to the static library
To add a class to the static library
To create a header file for a new class, right-click to open the shortcut menu for the MathLibrary project in Solution Explorer, and then choose Add > New Item.
In the Add New Item dialog box, select Visual C++ > Code. In the center pane, select Header File (.h). Specify a name for the header file—for example, MathLibrary.h—and then choose the Add button. A nearly blank header file is displayed.
Add a declaration for a class named
Arithmetic
to do common mathematical operations such as addition, subtraction, multiplication, and division. The code should resemble:To create a source file for the new class, open the shortcut menu for the MathLibrary project in Solution Explorer, and then choose Add > New Item.
In the Add New Item dialog box, in the center pane, select C++ File (.cpp). Specify a name for the source file—for example, MathLibrary.cpp—and then choose the Add button. A blank source file is displayed.
Use this source file to implement the functionality for class
Arithmetic
. The code should resemble:To build the static library, select Build > Build Solution on the menu bar. The build creates a static library, MathLibrary.lib, that can be used by other programs.
Note
When you build on the Visual Studio command line, you must build the program in two steps. First, run
cl /c /EHsc MathLibrary.cpp
to compile the code and create an object file that's named MathLibrary.obj. (Thecl
command invokes the compiler, Cl.exe, and the/c
option specifies compile without linking. For more information, see /c (Compile Without Linking).) Second, runlib MathLibrary.obj
to link the code and create the static library MathLibrary.lib. (Thelib
command invokes the Library Manager, Lib.exe. For more information, see LIB Reference.)
Create a C++ console app that references the static library
To create a C++ console app that references the static library in Visual Studio 2019
In Solution Explorer, right-click on the top node, Solution 'StaticMath', to open the shortcut menu. Choose Add > New Project to open the Add a New Project dialog box.
At the top of the dialog, set the Project type filter to Console.
From the filtered list of project types, choose Console App then choose Next. In the next page, enter MathClient in the Name box to specify a name for the project.
Choose the Create button to create the client project.
After you create a console app, an empty program is created for you. The name for the source file is the same as the name that you chose earlier. In the example, it's named
MathClient.cpp
.
To create a C++ console app that references the static library in Visual Studio 2017
In Solution Explorer, right-click on the top node, Solution 'StaticMath', to open the shortcut menu. Choose Add > New Project to open the Add a New Project dialog box.
In the Add New Project dialog box, select Installed > Visual C++ > Windows Desktop. In the center pane, select Windows Desktop Wizard.
Specify a name for the project—for example, MathClient—in the Name box. Choose the OK button.
In the Windows Desktop Project dialog, under Application type, select Console Application (.exe).
Under Additional Options, uncheck the Precompiled header check box if it's checked.
Choose OK to create the project.
After you create a console app, an empty program is created for you. The name for the source file is the same as the name that you chose earlier. In the example, it's named
MathClient.cpp
.
To create a C++ console app that references the static library in Visual Studio 2015
In Solution Explorer, right-click on the top node, Solution 'StaticMath', to open the shortcut menu. Choose Add > New Project to open the Add a New Project dialog box.
In the Add New Project dialog box, select Installed > Visual C++ > Win32. In the center pane, select Win32 Console Application.
Specify a name for the project—for example, MathClient—in the Name box. Choose the OK button.
In the Win32 Application Wizard dialog, choose Next.
On the Application Settings page, under Application type, make sure Console application is selected. Under Additional options, uncheck Precompiled header, then check the Empty Project checkbox. Choose Finish to create the project.
To add a source file to the empty project, right-click to open the shortcut menu for the MathClient project in Solution Explorer, and then choose Add > New Item.
In the Add New Item dialog box, select Visual C++ > Code. In the center pane, select C++ File (.cpp). Specify a name for the source file—for example, MathClient.cpp—and then choose the Add button. A blank source file is displayed.
Use the functionality from the static library in the app
Dev-c 2b 2b To Create Pdf File
To use the functionality from the static library in the app
Before you can use the math routines in the static library, you must reference it. Open the shortcut menu for the MathClient project in Solution Explorer, and then choose Add > Reference.
The Add Reference dialog box lists the libraries that you can reference. The Projects tab lists the projects in the current solution and any libraries they reference. Open the Projects tab, select the MathLibrary check box, and then choose the OK button.
To reference the
MathLibrary.h
header file, you must modify the included directories path. In Solution Explorer, right-click on MathClient to open the shortcut menu. Choose Properties to open the MathClient Property Pages dialog box.In the MathClient Property Pages dialog box, set the Configuration drop-down to All Configurations. Set the Platform drop-down to All Platforms.
Select the Configuration Properties > C/C++ > General property page. In the Additional Include Directories property, specify the path of the MathLibrary directory, or browse for it.
To browse for the directory path:
Open the Additional Include Directories property value drop-down list, and then choose Edit.
In the Additional Include Directories dialog box, double-click in the top of the text box. Then choose the ellipsis button (...) at the end of the line.
In the Select Directory dialog box, navigate up a level, and then select the MathLibrary directory. Then choose the Select Folder button to save your selection.
In the Additional Include Directories dialog box, choose the OK button.
In the Property Pages dialog box, choose the OK button to save your changes to the project.
You can now use the
Arithmetic
class in this app by including the#include 'MathLibrary.h'
header in your code. Replace the contents ofMathClient.cpp
with this code:To build the executable, choose Build > Build Solution on the menu bar.
Run the app
To run the app
Make sure that MathClient is selected as the default project. To select it, right-click to open the shortcut menu for MathClient in Solution Explorer, and then choose Set as StartUp Project.
To run the project, on the menu bar, choose Debug > Start Without Debugging. The output should resemble:
See also
Walkthrough: Creating and Using a Dynamic Link Library (C++)
Desktop Applications (Visual C++)
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.
- Go to the 'Tools' menu and select 'Compiler Options'.
- In the 'Settings' tab, click on 'Linker' in the left panel, and change 'Generate debugging information' to 'Yes':
- Click 'OK'.
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.
- Go to the 'File' menu and select 'New', 'Project...'.
- Choose 'Empty Project' and make sure 'C++ project' is selected.
Here you will also give your project a name. You can give your project any valid filename, but keep in mind that the name of your project will also be the name of your final executable. - Once you have entered a name for your project, click 'OK'.
- Dev-C++ will now ask you where to save your project.
Step 3: Create/add source file(s).
You can add empty source files one of two ways:
- Go to the 'File' menu and select 'New Source File' (or just press CTRL+N) OR
- Go to the 'Project' menu and select 'New File'.
Note that Dev-C++ will not ask for a filename for any new source file until you attempt to:- Compile
- Save the project
- Save the source file
- Exit Dev-C++
- Go to the 'Project' menu and select 'Add to Project' OR
- Right-click on the project name in the left-hand panel and select 'Add to Project'.
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.
- Go to the 'Execute' menu and select 'Compile' (or just press CTRL+F9).
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.
- Go to the 'Execute' menu, choose 'Run'.
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:
- Method 1 - Adding one library call:
On the line before the main's return enter:system('Pause');
- Method 2 - Scaffolding:
Add the following code before any return statement in main() or any exit() or abort() statement (in any function):/* 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 */ - Method 3 - Command-prompt:
Alternatively, instead of using Dev-C++ to invoke your program, you can just open an MS-DOS Prompt, go to the directory where your program was compiled (i.e. where you saved the project) and enter the program name (along with any parameters). The command-prompt window will not close when the program terminates.
For what it's worth, I use the command-line method.
To create a static library project in Visual Studio 2017
On the menu bar, choose File > New > Project.
In the New Project dialog box, select Installed > Visual C++ > Windows Desktop. In the center pane, select Windows Desktop Wizard.
Specify a name for the project—for example, MathLibrary—in the Name box. Specify a name for the solution—for example, StaticMath—in the Solution Name box. Choose the OK button.
In the Windows Desktop Project dialog, under Application type, select Static Library (.lib).
Under Additional Options, uncheck the Precompiled header check box if it's checked. Check the Empty project box.
Choose OK to create the project.
To create a static library project in Visual Studio 2015
Dev-c 2b 2b To Create Pdfs
On the menu bar, choose File > New > Project.
In the New Project dialog box, select Installed > Templates > Visual C++ > Win32. In the center pane, select Win32 Console Application.
Specify a name for the project—for example, MathLibrary—in the Name box. Specify a name for the solution—for example, StaticMath—in the Solution Name box. Choose the OK button.
In the Win32 Application Wizard, choose Next.
In the Application Settings page, under Application type, select Static library. Under Additional options, uncheck the Precompiled header checkbox. Choose Finish to create the project.
Add a class to the static library
To add a class to the static library
To create a header file for a new class, right-click to open the shortcut menu for the MathLibrary project in Solution Explorer, and then choose Add > New Item.
In the Add New Item dialog box, select Visual C++ > Code. In the center pane, select Header File (.h). Specify a name for the header file—for example, MathLibrary.h—and then choose the Add button. A nearly blank header file is displayed.
Add a declaration for a class named
Arithmetic
to do common mathematical operations such as addition, subtraction, multiplication, and division. The code should resemble:To create a source file for the new class, open the shortcut menu for the MathLibrary project in Solution Explorer, and then choose Add > New Item.
In the Add New Item dialog box, in the center pane, select C++ File (.cpp). Specify a name for the source file—for example, MathLibrary.cpp—and then choose the Add button. A blank source file is displayed.
Use this source file to implement the functionality for class
Arithmetic
. The code should resemble:To build the static library, select Build > Build Solution on the menu bar. The build creates a static library, MathLibrary.lib, that can be used by other programs.
Note
When you build on the Visual Studio command line, you must build the program in two steps. First, run
cl /c /EHsc MathLibrary.cpp
to compile the code and create an object file that's named MathLibrary.obj. (Thecl
command invokes the compiler, Cl.exe, and the/c
option specifies compile without linking. For more information, see /c (Compile Without Linking).) Second, runlib MathLibrary.obj
to link the code and create the static library MathLibrary.lib. (Thelib
command invokes the Library Manager, Lib.exe. For more information, see LIB Reference.)
Create a C++ console app that references the static library
To create a C++ console app that references the static library in Visual Studio 2019
In Solution Explorer, right-click on the top node, Solution 'StaticMath', to open the shortcut menu. Choose Add > New Project to open the Add a New Project dialog box.
At the top of the dialog, set the Project type filter to Console.
From the filtered list of project types, choose Console App then choose Next. In the next page, enter MathClient in the Name box to specify a name for the project.
Choose the Create button to create the client project.
After you create a console app, an empty program is created for you. The name for the source file is the same as the name that you chose earlier. In the example, it's named
MathClient.cpp
.
To create a C++ console app that references the static library in Visual Studio 2017
In Solution Explorer, right-click on the top node, Solution 'StaticMath', to open the shortcut menu. Choose Add > New Project to open the Add a New Project dialog box.
In the Add New Project dialog box, select Installed > Visual C++ > Windows Desktop. In the center pane, select Windows Desktop Wizard.
Specify a name for the project—for example, MathClient—in the Name box. Choose the OK button.
In the Windows Desktop Project dialog, under Application type, select Console Application (.exe).
Under Additional Options, uncheck the Precompiled header check box if it's checked.
Choose OK to create the project.
After you create a console app, an empty program is created for you. The name for the source file is the same as the name that you chose earlier. In the example, it's named
MathClient.cpp
.
To create a C++ console app that references the static library in Visual Studio 2015
In Solution Explorer, right-click on the top node, Solution 'StaticMath', to open the shortcut menu. Choose Add > New Project to open the Add a New Project dialog box.
In the Add New Project dialog box, select Installed > Visual C++ > Win32. In the center pane, select Win32 Console Application.
Specify a name for the project—for example, MathClient—in the Name box. Choose the OK button.
In the Win32 Application Wizard dialog, choose Next.
On the Application Settings page, under Application type, make sure Console application is selected. Under Additional options, uncheck Precompiled header, then check the Empty Project checkbox. Choose Finish to create the project.
To add a source file to the empty project, right-click to open the shortcut menu for the MathClient project in Solution Explorer, and then choose Add > New Item.
In the Add New Item dialog box, select Visual C++ > Code. In the center pane, select C++ File (.cpp). Specify a name for the source file—for example, MathClient.cpp—and then choose the Add button. A blank source file is displayed.
Use the functionality from the static library in the app
Dev-c 2b 2b To Create Pdf File
To use the functionality from the static library in the app
Before you can use the math routines in the static library, you must reference it. Open the shortcut menu for the MathClient project in Solution Explorer, and then choose Add > Reference.
The Add Reference dialog box lists the libraries that you can reference. The Projects tab lists the projects in the current solution and any libraries they reference. Open the Projects tab, select the MathLibrary check box, and then choose the OK button.
To reference the
MathLibrary.h
header file, you must modify the included directories path. In Solution Explorer, right-click on MathClient to open the shortcut menu. Choose Properties to open the MathClient Property Pages dialog box.In the MathClient Property Pages dialog box, set the Configuration drop-down to All Configurations. Set the Platform drop-down to All Platforms.
Select the Configuration Properties > C/C++ > General property page. In the Additional Include Directories property, specify the path of the MathLibrary directory, or browse for it.
To browse for the directory path:
Open the Additional Include Directories property value drop-down list, and then choose Edit.
In the Additional Include Directories dialog box, double-click in the top of the text box. Then choose the ellipsis button (...) at the end of the line.
In the Select Directory dialog box, navigate up a level, and then select the MathLibrary directory. Then choose the Select Folder button to save your selection.
In the Additional Include Directories dialog box, choose the OK button.
In the Property Pages dialog box, choose the OK button to save your changes to the project.
You can now use the
Arithmetic
class in this app by including the#include 'MathLibrary.h'
header in your code. Replace the contents ofMathClient.cpp
with this code:To build the executable, choose Build > Build Solution on the menu bar.
Run the app
To run the app
Make sure that MathClient is selected as the default project. To select it, right-click to open the shortcut menu for MathClient in Solution Explorer, and then choose Set as StartUp Project.
To run the project, on the menu bar, choose Debug > Start Without Debugging. The output should resemble:
See also
Walkthrough: Creating and Using a Dynamic Link Library (C++)
Desktop Applications (Visual C++)
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.
- Go to the 'Tools' menu and select 'Compiler Options'.
- In the 'Settings' tab, click on 'Linker' in the left panel, and change 'Generate debugging information' to 'Yes':
- Click 'OK'.
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.
- Go to the 'File' menu and select 'New', 'Project...'.
- Choose 'Empty Project' and make sure 'C++ project' is selected.
Here you will also give your project a name. You can give your project any valid filename, but keep in mind that the name of your project will also be the name of your final executable. - Once you have entered a name for your project, click 'OK'.
- Dev-C++ will now ask you where to save your project.
Step 3: Create/add source file(s).
You can add empty source files one of two ways:
- Go to the 'File' menu and select 'New Source File' (or just press CTRL+N) OR
- Go to the 'Project' menu and select 'New File'.
Note that Dev-C++ will not ask for a filename for any new source file until you attempt to:- Compile
- Save the project
- Save the source file
- Exit Dev-C++
- Go to the 'Project' menu and select 'Add to Project' OR
- Right-click on the project name in the left-hand panel and select 'Add to Project'.
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.
- Go to the 'Execute' menu and select 'Compile' (or just press CTRL+F9).
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.
- Go to the 'Execute' menu, choose 'Run'.
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:
- Method 1 - Adding one library call:
On the line before the main's return enter:system('Pause');
- Method 2 - Scaffolding:
Add the following code before any return statement in main() or any exit() or abort() statement (in any function):/* 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 */ - Method 3 - Command-prompt:
Alternatively, instead of using Dev-C++ to invoke your program, you can just open an MS-DOS Prompt, go to the directory where your program was compiled (i.e. where you saved the project) and enter the program name (along with any parameters). The command-prompt window will not close when the program terminates.
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 ' (not string.h). Next, make sure you add 'using namespace std;' after your includes.
Example:
That's it for now.I am not a Dev-C++ expert by any means (in fact, I do not teach C++ nor use it on a regular basis), but if you have any questions, feel free to email me at jaime@cs.uno.edu
Happy coding!