Developing C programs using Eclipse IDE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video i would like to show you how to set up eclipse to do c program development so the first thing is we need to download uh all of the software and there's really three uh software tools that you will need um you will need uh cygwin uh for the uh c compiler and tool chain you're gonna need uh jdk from oracle the java development kit and you're gonna actually need the eclipse package itself the eclipse ide for the the gui to actually do the program development so let's get started so the first thing is we want to get the c compiler so this is going to be a cygwin.org and you're going to need to download the setup file and you need these four packages you need uh gcc core uh gcc g plus plus gdb and make so you want to get those for within the devel option so let me show you that so the first thing is you want to go to cygwin.org and you want to download this executable file setup x86 64. so you just download this file and once you download it it'll look like this setup x8664 application so you want to double click on this and just follow all the prompts install from internet it's going to put it in the c cygwin64 directory let's hit next uh select a download site so you can just pick the uh the first one okay so when this comes up um you're gonna see um select packages and that's what i was showing you here is that you need to get these four packages okay so let's get back here so category package all you want to go to this devel option and you're going to grab um gcc core and here i've i've already actually got it but if you haven't downloaded it it'll probably say skip here so you just come over here to this drop down and just pick like the latest version here um so that's where you would actually select it so because i've already done this it shows these as not saying skip but see all these others say skip like for this one you would come over here and just grab like the latest version um but since i've already done it i've already got the versions here um but those are the four you need you need gcc core okay you need a gcc g plus plus gdb and make which is here make so again just come over to this drop down menu and select like the latest version okay and then basically [Music] you would just click next and um it may say like install so you want to do that so you basically just follow all the prompts but i wanted to show you how to actually select those four um packages okay and so aside from that you would just follow the um you know next or install or whatever it says to actually get it downloaded so since i already have it i'm just going to go ahead and cancel out here okay all right so that takes care of of getting the c compiler next thing we want to do is make sure you download um from oracle's website the uh the jdk executable so here's the website so you just come here now you're going to have to create an account for oracle but it's free here see i can sign in or i can create an account just sign in okay and the one you want is the java sc development kit 11.0.8 and you want the windows 64 installer so you would just select this guy right here this executable and once you do that um you'll get this application here jdk 11 8 windows x64 bin and double click that and just go through you know the normal setup process okay so we've got the cygwin set up where i've shown you which packages to select and now the jdk you double click that and that would set up the java development kit and the last thing is the actual eclipse itself and that's going to be the one for c c plus plus developers so you go to here eclipse um i've shown you the website scroll down here to this eclipse ide for c c plus plus developers windows 64-bit um if you're using windows and just click on that and download and that will give you this folder okay so you're going to get this zipped folder um here and then you would extract all extract all to get the unzipped folder and if you double click on that double click then you've got the eclipse application and that's that's what we want to use uh to do the um c programming so we want to use the eclipse application and i've actually got a shortcut here an eclipse shortcut so double click that now it's going to ask you for a workspace and just put in basically where you want to um store all your work so i've got this here in this path here on my usb drive but you just pick whatever wherever you want the workspace to be i mean that's that's what you're always going to use the same workspace um and just create and store your projects within that workspace so i'm going to leave it the way it is right there for now and go ahead and click launch and so it comes up here now sometimes you may see a welcome screen which is okay if you see the welcome screen you can just close that out but the main thing we want to do now is create a project okay we want to create a project so you can just click here create a new c or c plus project um you know you could also go up here to file new c c plus plus project um however you want to do it so i'll just select it here create a new c or c plus project and we want to do a c managed build okay click next and we want to do an empty project and i'm going to use cygwin gcc because that's what i downloaded um project name i'm going to call this ascii art so this will be my first project ascii art empty project sigmund gcc and we're going to click next and select configurations just go ahead and you can just leave the debug and the release is fine just the default and hit finish and that will create the project so here it is ascii art if we expand this you'll see it's got some includes here but we don't actually have a program yet so all we have is the we've created a project but the project's essentially empty except for these includes so what we want to do is create an actual dot c file so we go file new source file and i'm gonna it's gonna be in the ascii art source folder so that was my project and i'm i'm gonna give it the same name so i'm gonna call it ascii art and i wanna do dot c so my source folder will be ascii art my source file will be ascii art dot c and finish and now i've got an actual um got an actual source file and see how it just gives you this kind of standard header here and i'm going to delete that because i've already got files i want to work with so i'm going to go grab ascii art.c and copy and paste that in there of course if you if you didn't already have a you know file you would just start writing your code inside this window here but i already had a file so um i just you know pasted it in and now we have a file so you go up here you can do um save so that's gonna save that's gonna save the file and there it is okay so if you look here you can see under the project we've got the includes and we've got our our source file so now we need to actually build this and the way you build this is go up to project build project so i'm going to build the project okay and i've got zero errors and zero warnings which is good okay and now you can see it it added um let's see binaries but also there's a debug folder so it's got this debug folder so now i've actually got an executable file and the last thing we need to do so after we build the built the project we need to run the project and one way you can do that is under this thing called launch configurations and so which what you can do is just click on this and do new launch configuration and i'm going to launch this the mode i'm going to launch in run mode and it's a c c plus plus application and um i'm actually gonna it gives you this kind of default but i'm gonna just kind of rename this underscore run so i'm going to call the application launch or the uh the launch configuration ascii art run and the projects ascii art and the application is actually in the debug folder so remember the debug folder has the actual has the actual executable file so this should be populated by default and you just give it a name for the launch configuration and hit apply and finish okay and now you go up here we've got ascii art run and we can just click on this launch and run mode so this uh green circle with a triangle and there it is so on the console all this is doing is is printing out um it's just using a bunch of printf statements it's a bunch of printout statements to just print out some uh some graphics here okay um so that's it that's how you um that's how you develop a c program within an eclipse now i'll do um the thing is you you know you probably will be doing more than one project so let me just show you that real quick so um i could add so i'm in the same workspace but let me add a new c c plus plus project c managed build this one i'm going to call sizes and this is going to be an empty project and sigmund again next and just do the defaults finish okay so now i've got a um now i've got a sizes project just like i had an ascii art project again i need to add a source file so let's add a source file and i'm going to call it the same thing sizes dot c and hit finish so now here's ascii art.c but i want to work with sizes.c and i've got another file here paste that in and all this is doing is just showing the sizes of different um data types and uh and how much memory they occupy and their ranges things like that it's just just kind of a yeah just showing you different different data types so anyway um let's go ahead and save i'm gonna save that okay and i want to build it so i'm going to go to project build project now i've got see i've got that debug folder again and i've got these binaries so the debug has the executable file right and so what do i need to do next well i need to select or make another launch configuration so i'm going to go here to new launch configuration run c c plus plus application and again i'm just going to call this um sizes underscore run project sizes the applications debug sizes.exe apply and finish and that's it okay so now if you come up here you can see that i've got my two configurations but now i want to run sizes so i'll go ahead and run that and see how this just prints out like a character you know is eight bits so it occupies one byte in memory um a short integer takes up two bytes so on and so forth so this this is kind of just showing you you know how much memory each data type occupies and the range of values so if you declare a long integer then you've got a you know this range of values you could um use to put in to store in that memory and then if i want to go back and hey i want to run my other program i just go to ascii art run and run okay so now i just ran the ascii art program go back to sizes go back to sizes and run that one okay so that's that's pretty cool okay um and i want to do one more um i'm gonna do one more so i'm gonna do file um new c c plus plus project c managed build and this one's gonna be smallest number finish okay and of course what do i do next i need to create a new source file oops let me select that smallest number file new source file so this is going to be smallest number dot c right and paste in that code save build projects okay and let's create a new launch configuration apply finish now i can run it okay this one actually takes in some input so let's put in say 85 negative 500 0. so the smallest integer is negative 500 and that's it that's it now one thing you can do if you're not you know you don't have to keep all these open you could actually go to let's say ascii art right click and you can actually close project okay so if i'm not using that project i can close it and then but i won't be able to run it up here okay i would need to open the project to be able to run it one other quick thing i'll point out before we end this video i discovered an eclipse there's an issue with the basically printing and scanning from the console so i believe what's happening is it's kind of buffering things before it writes writes it to the console so one workaround you can do is is to use this thing called set vbuff and of course standard out is the the console and just put null 0 and then this underscore ion buff basically writes thing out writes things out as fast as possible so um so if you were to go to c plus plus dot com c library set b buff you can look look this up this is a really really good website um in set v buff if you look down here this underscore ion buff says no buffering so each i o operation is written as soon as possible so basically that's what we want for um for these applications so anyway this is a really i really like this website and it gives you the the function prototypes and and it'll give you some examples and things this is really good um so if we go back here so that's why i put that you know this line here um because if i don't have this here there will be some issue with with printing and scanning um so anyway um yeah so i think i'll end for right now um i just wanted to show you in a clips how you can um write and develop c programs um so oh and for right now we won't go into like debugging and things like that so this is just a quick introduction to to get you started so that you can actually um create some programs that will perform or solve whatever problem that you're looking to solve okay that's all um i hope you found this useful
Info
Channel: Austin Hewin
Views: 19,087
Rating: undefined out of 5
Keywords:
Id: yMPMGNcDIjI
Channel Id: undefined
Length: 25min 10sec (1510 seconds)
Published: Wed Aug 12 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.