Thread: C programing
View Single Post
Old 14-07-2021, 20:16  Translate from English to Italian  Translate from English to French  Translate from English to German  Translate from English to Spanish  Translate from English to Dutch  Translate from English to Greek  Translate from English to Portuguese  Translate from English to Russian  Translate from English to Russian
cayoenrique cayoenrique is offline
Linux advisor
Senior Member
Join Date: May 2018
Posts: 500
Thanks: 319
Thanked 764 Times in 279 Posts
Country: Country Flag

As I am to start my first programming lab I found that I mos to the first lesson any way with hellow word.

#: mkdir -p $HOME/cryptodir/Labs/006
#: cd $HOME/cryptodir/Labs/006
sudo apt update
sudo apt install codeblocks
Now to start codeblocks you can use your start menu or even type in your terminal codeblocks If it is your 1rst time you will see a window telling you about what compiler. Just leave it in GNU GCC.
Once up we click on [Create a new project] and in new windows select [Console Application].
Next Window click on C. Please notice not C++. And hit [Next].
Next Window type in Project title: csa_core
In folder use [***] to browse your working folder, mine is /enrique/cryptodir/Labs/006/
As you may notice the other 2 inputs are filed automatic with the info you just enter previously. So Hit [Next].
In this new window you do not need to do anything just leave compiler as GNU GCC Compiler.

As this is 1rst time lets to some arrangement.
Hit Maximize so that codeblocks use whole screen.
Now go and select Menu>View>Toolbars>Optimize toolbars
Finally lets add a check mark in Menu>View>Logs Your screen should look like this:
Click to enlarge

Lets do a quick description.
AT the top as most GUI programs we have the Menu and the Toolbar with short cuts.
Below on the left is the Management. At th moment it has 2 tabs. Projects and Resources. Leave it in Projects as it shows your files. You should see Workspace>csa_core>sources.
In the right up we have the editor, below it the Log window.

Now every time you create a project codeblocks will add a main.c with Hellow word sample project. Just basic skeleton to get you started. Lest edit it.
In the left the file structure have small black triangle. The top one point down meaning the are maximized. But Source is pointing Right. Lets click on the Sources black triangle. It will point down and maximize reveling main.c
Now Double Click on main.c and you should see in the right its content. It should look like

Click to enlarge

Now lets build and execute it. Click on Menu>Build>Run.
It will ask us if we what to build it 1rst. Click on [YES]

The program will build, you can see now that Log windows is in TAB Build Log and you should see
Output file is bin/Debug/csa_core with size 18.63 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
And an output terminal should open showing you any output the program does. In this case you see it prints Hellow world!.
But to allow you to read its output the program at the end waits for you to hit [Enter]. Hit Enter and the windows closes. This is how it looks
Click to enlarge

To & quit you just do
Menu>File>Save Workspace

If you do just Quit it should as you if you want to save any unsaved file.
Reply With Quote
The Following 2 Users Say Thank You to cayoenrique For This Useful Post:
dijitalxyz (04-08-2021), Me2019H (27-12-2021)