{"id":4601,"date":"2013-10-05T05:01:53","date_gmt":"2013-10-04T19:01:53","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4601"},"modified":"2019-10-22T20:02:00","modified_gmt":"2019-10-22T10:02:00","slug":"codeblocks-ide-d-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/codeblocks-ide-d-primer-tutorial\/","title":{"rendered":"Code::Blocks IDE D Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/CodeBlocks\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Code::Blocks IDE D Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/CodeBlocks\/CodeBlocks_Primer-28of.jpg\" title=\"Code::Blocks IDE D Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">Code::Blocks IDE D Primer Tutorial<\/p><\/div>\n<p>The tutorial today is about a programming IDE called Code::Blocks, and it builds on yesterday&#8217;s <a target=_blank href=\"#dpt\">D Primer Tutorial<\/a> as shown below.<\/p>\n<p>Programming <a target=_blank title='IDE information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/IDE\u200e'>IDE<\/a>s take a lot of the hard work out of tasks such as compiling and linking in languages such as D, Matlab, Fortran (Code::Blocks) or Java, C, C++, VB.Net and C# (NetBeans) &#8230; and please know that there are many other languages and many other IDEs.   In the case of Code::Blocks IDE, which this blog introduces to you today (it&#8217;s customary to shake hands, and no <a target=_blank title='pardon?' href='http:\/\/www.youtube.com\/watch?v=SGZV6fsotYo'>Klingon<\/a> is necessary), it can create a D code project environment.   To cut a long story short, there aint nothin&#8217; wrong with a good ol&#8217; IDE, but beware of IDEs in <a target=_blank title='Ides of March' href='https:\/\/www.youtube.com\/watch?v=Je0gTnheVe4'>March<\/a>.<\/p>\n<p>In saying that about IDEs, and how they make programming easier, often with Open Source programming, it is advantageous to know what goes on &#8220;under the hood&#8221; (or even &#8220;in the &#8216;hood&#8221; &#8230; chortle, chortle).   So if you ever get an opportunity to get helped creating your own makefile (or make it yourself, even with the <a target=_blank title='Sweet Green Icing' href='http:\/\/www.youtube.com\/watch?v=CPMpeNDIGdk'>Sweet Green Icing<\/a> &#8230; knew it could be worked in!) for something, take the opportunity to learn how to do this, as the Open Source world will become a little easier to navigate with such types of knowledge.   You&#8217;ve got to admire those early designers of computer languages, and those days when all you had was this tiny bit of memory (<a target=_blank title='64k' href='http:\/\/www.crashonline.org.uk\/39\/z88.htm'>64k<\/a> or <a target=_blank title='Voyager computer system' href='http:\/\/www.activeastronomy.org\/Home\/daniel'>&#8220;into the heliosphere on 8,000 bytes of memory&#8221;<\/a>) to play with to create your program.   <\/p>\n<p>In today&#8217;s <a target=_blank title='click on picture' href=\"http:\/\/www.rjmprogramming.com.au\/CodeBlocks\/\">tutorial<\/a> we write a simple D program based on  <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/C\/D\/idea.d_GETME' title='idea.d'>idea.d<\/a> of yesterday, to do with a MovingAverage program, with some simple struct and class bits added on, all under the supervision of Code::Blocks IDE.<\/p>\n<p>Code::Blocks can be an IDE for much more than D &#8230; it can supervise Matlab, Fortran, ARM, AVR, Direct\/X, FLTK, GLFW, GLUT, GTK+, Irrlicht, Lightfeather, MCS51, Ogre, OpenGL, PowerPC, QT4, SDL, SFML, STL port, SmartWin, TriCore and wxWidgets projects.   In coming days and weeks we&#8217;ll look at more.<\/p>\n<p>So with the <a target=_blank title='D in Code::Blocks' href=\"http:\/\/www.rjmprogramming.com.au\/CodeBlocks\/\">tutorial<\/a> today we don&#8217;t do Hello World exactly, but it is pretty simple code to give a moving average of record (lengths) entered at the keyboard interactively, and show a rudimentary struct and class usage.   By the way, if this had been written in C as hello.c and put into the right place, the compilation of this into a Digital Mars C program would have been as simple as &#8230; dmc hello.c &#8230; (and then &#8230; hello &#8230; to run &#8230; cute (and easy), huh?)<\/p>\n<p>Link to Code::Blocks &#8220;spiritual home&#8221; download page at <a target=_blank title='Code::Blocks download page' href='http:\/\/www.codeblocks.org\/downloads'>Code::Blocks<\/a>.<\/p>\n<p>Link to D information &#8230; <a target=_blank title='D' href=\"http:\/\/en.wikipedia.org\/wiki\/D_(programming_language)\u200e\">from Wikipedia<\/a> &#8230; source of quote above.<br \/>\nLink to Digital Mars D download page &#8230; <a target=_blank title='Digital Mars' href='http:\/\/dlang.org\/download.html'>here<\/a>.<br \/>\nLink to some downloadable D code &#8230; rename to <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/CodeBlocks\/hello.d_GETME' title='hello.d'>hello.d<\/a>\n<\/p>\n<hr \/>\n<p id='dpt'>Previous <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=4586\">D Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/C\/D\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"D Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/C\/D\/D_DigitalMars_CodeBlocks_Primer-9of.jpg\" title=\"D Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">D Primer Tutorial<\/p><\/div>\n<p>Yes, there is a D &#8230; D comes after C &#8230; and that pans out to be true &#8230; but what if we find life on Mars &#8230; you heard it here.<\/p>\n<p>Have been a fan of what Digital Mars do for a while, because if you are interested in programming languages you don&#8217;t want to interfere with various IDE programming language compilation arrangements, and the GCC\/Xcode relationship, for example, is quite complex, and you probably don&#8217;t want to push its functionality in wrong directions, or you could break your environment &#8230; and we all know <a target=_blank title='breaking up' href='http:\/\/www.youtube.com\/watch?v=tbad22CKlB4'><i>breaking up is hard to do<\/i><\/a>.<\/p>\n<p>Digital Mars C is like an independent voice (but in saying that, tomorrow&#8217;s tutorial shows it integrated into Code::Blocks IDE) and have been using it successfully on Windows for quite some time, especially for quick one off programs that need doing &#8230; though the &#8220;toast at breakfast even if you don&#8217;t want it&#8221; algorithm still needs work.<\/p>\n<p>Am selling Digital Mars short to just stop at that.   Take a look at the language D (it comes after C), and yes, with Digital Mars arrangements, please first install C (didn&#8217;t show you this with install, but &#8220;just do the Nike&#8221; on it).<\/p>\n<p>Let&#8217;s look at Wikipedia view of D &#8230; will make it that it comes after C<\/p>\n<blockquote><p>The D programming language is an object-oriented, imperative, multi-paradigm system programming language created by Walter Bright of Digital Mars. Though it originated as a re-engineering of C++, D is a distinct language, having redesigned some core C++ features while also taking inspiration from other languages, notably Java, Python, Ruby, C#, and Eiffel.<\/p>\n<p>D&#8217;s design goals attempt to combine the performance of compiled languages with the safety and expressive power of modern dynamic languages. Idiomatic D code is commonly as fast as equivalent C++ code, while being shorter and memory-safe. [7]<\/p>\n<p>Type inference, automatic memory management and syntactic sugar for common types allow faster development, while bounds checking, design by contract features and a concurrency-aware type system help reduce the occurrence of bugs.[8]<\/p><\/blockquote>\n<p> &#8230; chortle &#8230; chortle<\/p>\n<p>So with the <a target=_blank title='D' href=\"http:\/\/www.rjmprogramming.com.au\/C\/D\/\">tutorial<\/a> today we don&#8217;t do Hello World exactly, but it is pretty simple code to give a moving average of record (lengths) entered at the keyboard interactively.   By the way, if this had been written in C as idea.c and put into the right place , the compilation of this into a Digital Mars C program would have been as simple as &#8230; dmc idea.c &#8230; (and then &#8230; idea &#8230; to run &#8230; cute (and easy), huh?)<\/p>\n<p>Link to D information &#8230; <a target=_blank title='D' href=\"http:\/\/en.wikipedia.org\/wiki\/D_(programming_language)\u200e\">from Wikipedia<\/a> &#8230; source of quote above.<br \/>\nLink to Digital Mars D download page &#8230; <a target=_blank title='Digital Mars' href='http:\/\/dlang.org\/download.html'>here<\/a>.<br \/>\nLink to some downloadable D code &#8230; rename to <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/C\/D\/idea.d_GETME' title='idea.d'>idea.d<\/a>\n<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d4586' onclick='var dv=document.getElementById(\"d4586\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=Digital+Mars\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d4586' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr \/>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d4601' onclick='var dv=document.getElementById(\"d4601\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=Digital+Mars\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d4601' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The tutorial today is about a programming IDE called Code::Blocks, and it builds on yesterday&#8217;s D Primer Tutorial as shown below. Programming IDEs take a lot of the hard work out of tasks such as compiling and linking in languages &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/codeblocks-ide-d-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,12,28,33,37],"tags":[102,121,220,287,335,447,456,498,502,546,558,637,696,755,759,859,880,974,997,1015,1108,1128,1158,1199,1307,1319,1466],"class_list":["post-4601","post","type-post","status-publish","format-standard","hentry","category-codeblocks","category-elearning","category-oop","category-software","category-tutorials","tag-arm","tag-avr","tag-codeblocks","tag-d","tag-directx","tag-fltk","tag-fortran","tag-glfw","tag-glut","tag-gtk","tag-hello-world","tag-irrlicht","tag-lightfeather","tag-matlab","tag-mcs51","tag-ogre","tag-opengl","tag-powerpc","tag-programming","tag-qt4","tag-sdl","tag-sfml","tag-smartwin","tag-stl-port","tag-tricore","tag-tutorial","tag-wxwidgets"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4601"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=4601"}],"version-history":[{"count":3,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4601\/revisions"}],"predecessor-version":[{"id":46910,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/4601\/revisions\/46910"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=4601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=4601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=4601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}