codeblocks-13.12mingw-setup.exe
(98 MB) (which includes MinGW's GNU GCC compiler and GNU GDB debugger).c:Program Filescodeblocks
', set it to 'c:Program FilescodeblocksMinGW
'.gdb.exe
', for example, 'c:Program FilescodeblocksMinGWbingdb.exe
'.Hello.cpp
' in your project directory (e.g., 'd:project
').HelloProject
'. In 'Folder to create project in', set to your working directory, e.g., 'd:project
'. Accept the default for the rest ⇒ Next.HelloProject
' will be created under 'd:project
', with a project configuration filename of 'HelloProject.cbp
'. You could later create more projects under this working directory 'd:project
'.HelloProject
' ⇒ Expand 'Source' node ⇒ Double-click 'main.cpp
', which is a template program to say 'Hello, world!'.ProjectName
.cbp
', where '.cbp' stands for CodeBlocks-Project.main()
function among all the source files. That is, you cannot keep two toy programs (each having a main()
function) in one project (you will get the error 'multiple definition of 'main' when you try to build the project). You need to create one project for each toy program. This is clumsy!main.cpp
' automatically.main.cpp
'. Build and run the program.myfirst.cpp
'. Remove it from the project (because each project can only have one file with main()
), by right-click on 'myfirst
.cpp
' ⇒ 'remove file from project'.main.cpp
'. Build and run.myfirst.cpp
' again: First remove 'main.cpp
' from the project. Right-click on the project ⇒ Add File.. ⇒ Choose 'myfirst.cpp
' ⇒ Open ⇒ Check both the 'Debug' and 'Release' box ⇒ OK. You can now build and run the 'myfirst.cpp
'.main()
function) under the active project. You can then 'Build' the project and 'Run' your toy program.codeblocks-10.05mingw-setup.exe
').c:Program FilescodeblocksMinGW
' suppose that CodeBlocks is installed in 'c:Program Filescodeblocks
'.main()
function in your function. Check your spelling of main
!scanf()
function. You probably omitted the '&'
before the variable name.n
(=1*2*3*..*n
). The program, however, has a logical error and produce a wrong answer for n=20
. (It outputs 'The Factorial of 20 is -2102132736' - a negative number?!).main()
function by clicking on the 'left-margin' (right-side of the line number) of the line containing main()
. A red circle appears indicating a breakpoint has been set at that line. A breakpoint suspends program execution for you to examine the internal states.main()
. An yellow arrow (as shown in the diagram) appears and points at the main()
, indicating this is the next statement to be executed.