{"id":1038,"date":"2025-06-04T08:26:02","date_gmt":"2025-06-04T07:26:02","guid":{"rendered":"https:\/\/workboot.fr\/ciela\/?page_id=1038"},"modified":"2025-06-04T09:33:18","modified_gmt":"2025-06-04T08:33:18","slug":"skeletonc","status":"publish","type":"page","link":"https:\/\/workboot.fr\/ciela\/skeletonc\/","title":{"rendered":"Skeletonc"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Un petit script pour r\u00e9aliser un projet c de base<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Exemple d&rsquo;utilisation pour r\u00e9aliser un projet bonjour le monde !<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bruno@elliott:~\/Works\/langage_C$ mkdir projet\nbruno@elliott:~\/Works\/langage_C$ cd projet\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#ff6900\" class=\"has-inline-color\">bruno@elliott:~\/Works\/langage_C\/projet$ skeletonc projet\nbruno@elliott:~\/Works\/langage_C\/projet$ ls\nMakefile  projet.c<\/mark>\nbruno@elliott:~\/Works\/langage_C\/projet$ make\ngcc projet.c -g -Wall -pedantic -ansi -o projet\nbruno@elliott:~\/Works\/langage_C\/projet$ ls\nMakefile  <mark style=\"background-color:rgba(0, 0, 0, 0);color:#cf2e2e\" class=\"has-inline-color\">projet<\/mark>  projet.c\nbruno@elliott:~\/Works\/langage_C\/projet$ .\/projet \nBonjour le monde <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Un fichier archive contient ce petit projet:  <a href=\"https:\/\/workboot.fr\/Download\/Scripts\/skeletonc_src.tar\">skeletonc_src.tar<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">sinon dans un r\u00e9pertoire ~\/Works\/skeletonc <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget workboot.fr\/Download\/Scripts\/skeletonc_src.tar<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">pour rapatrier le fichier <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">L&rsquo;archive skeletonc_src.tar  \u00e0 extraire dans \/usr\/local\/bin<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ce r\u00e9pertoire permet de placer des ex\u00e9cutables accessible \u00e0 tous les utilisateurs de la machine , dans notre cas : skeletonc et makeMakefile et on y place les squelettes .skel <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tar xvf skeletonc_src.tar -C \/usr\/local\/bin<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">apr\u00e8s vous pouvez effacer cette archive (le tar)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">c&rsquo;est install\u00e9 !<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">fichier : skeltonc  (executable)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\nif &#91; -z $1 ]\nthen \nnom=\"hello\"\nelse\nnom=$1\nfi\ncp \/usr\/local\/bin\/skeleton.c.skel $nom.c\nmakeMakefile $nom<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fichier : makeMakefile  (executable)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\nif &#91; -z $1 ]\nthen\nnom=\"hello\"\nelse \nnom=$1\nfi\necho TARGET = $nom &gt; Makefile\ncat \/usr\/local\/bin\/Makefile.skel &gt;&gt; Makefile<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">fichier: Makefile.skel<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#Makefile petit projet avec skeletonc\nCFLAGS = -g -Wall -pedantic -ansi\nCC = gcc\nDEB = gdb\n\n$(TARGET): $(TARGET).c\n        $(CC) $&lt; $(CFLAGS) -o $@\nedit:   $(TARGET).c\n        vi $(TARGET).c\ngdb:    $(TARGET)\n        $(DEB) $(TARGET)\nclean:\n        rm $(TARGET)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">fichier: skeleton.c.skel<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/********************************\n * Projet :\n * Auteur :\n * Date   :\n ********************************\/\n#include &lt;stdlib.h&gt;\n#include &lt;stdio.h&gt;\n\nint main (int argc, char **argv)\n{\n\tprintf (\"Bonjour le monde \\n\");\n\n\treturn EXIT_SUCCESS;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Usage de skeletonc<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">skeletonc est outil pour cr\u00e9er un petit projet c rapidement<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">dans le r\u00e9pertoire&nbsp; Works\/LangageC\/test<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">skeletonc test<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">va g\u00e9n\u00e9rer automatiquement un source c de base (squelette) et un makefile adapt\u00e9<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">on dispose de&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">make\u00a0qui va lancer la compilation avec gcc de notre projet.c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/********************************\n * Projet :\n * Auteur :\n * Date   :\n ********************************\/\n#include &lt;stdlib.h>\n#include &lt;stdio.h>\n\nint main (int argc, char **argv)\n{\n\tprintf (\"Bonjour le monde \\n\");\n\n\treturn EXIT_SUCCESS;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ne pas oublier de remplir le cartouche  Projet, Auteur et Date .<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TARGET = projet\n#Makefile petit projet avec skeletonc\nCFLAGS = -g -Wall -pedantic -ansi\nCC = gcc\n\n$(TARGET): $(TARGET).c\n\t$(CC) $&lt; $(CFLAGS) -o $@\n\n\nedit:\t$(TARGET).c\n\tvi $(TARGET).c\n\ngdb:\t$(TARGET)\n\t$(DEB) $(TARGET)\n\nclean:\n\trm $(TARGET)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">make edit\u00a0# va vous permettre d&rsquo;\u00e9diter le projet avec vi<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">make clean # nettoie le projet de son executable <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bruno@elliott:~\/Works\/langage_C\/projet$ ls\nMakefile  projet  projet.c\n<mark style=\"background-color:rgba(0, 0, 0, 0);color:#cf2e2e\" class=\"has-inline-color\">bruno@elliott:~\/Works\/langage_C\/projet$ make clean\nrm projet<\/mark>\nbruno@elliott:~\/Works\/langage_C\/projet$ ls\nMakefile  projet.c\nbruno@elliott:~\/Works\/langage_C\/projet$ <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">make gdb\u00a0# lance le debugger <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">par d\u00e9faut l&rsquo;option -g est positionn\u00e9e. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">make gdb   # voir le cours sur gdb<\/p>\n\n\n\n<pre>Reading symbols from <span style=\"color:#26A269\">projet<\/span>...\n(gdb) l\n1\t<span style=\"color:#2AA1B3\">\/********************************<\/span>\n2\t<span style=\"color:#2AA1B3\"> * Projet :<\/span>\n3\t<span style=\"color:#2AA1B3\"> * Auteur :<\/span>\n4\t<span style=\"color:#2AA1B3\"> * Date   :<\/span>\n5\t<span style=\"color:#2AA1B3\"> ********************************\/<\/span>\n6\t<span style=\"color:#12488B\"><b>#include<\/b><\/span> <span style=\"color:#C01C28\">&lt;stdlib.h&gt;<\/span>\n7\t<span style=\"color:#12488B\"><b>#include<\/b><\/span> <span style=\"color:#C01C28\">&lt;stdio.h&gt;<\/span>\n8\t\n9\t<span style=\"color:#26A269\">int<\/span> <b>main<\/b> <span style=\"color:#C01C28\">(<\/span><span style=\"color:#26A269\">int<\/span> argc<span style=\"color:#C01C28\">,<\/span> <span style=\"color:#26A269\">char<\/span> <span style=\"color:#C01C28\">**<\/span>argv<span style=\"color:#C01C28\">)<\/span>\n10\t<span style=\"color:#C01C28\">{<\/span>\n(gdb) l\n11\t\t<b>printf<\/b> <span style=\"color:#C01C28\">(&quot;Bonjour le monde <\/span><span style=\"color:#A347BA\">\\n<\/span><span style=\"color:#C01C28\">&quot;);<\/span>\n12\t\n13\t\t<span style=\"color:#12488B\"><b>return<\/b><\/span> EXIT_SUCCESS<span style=\"color:#C01C28\">;<\/span>\n14\t<span style=\"color:#C01C28\">}<\/span>\n(gdb) br main\nBreakpoint 1 at <span style=\"color:#12488B\">0x1148<\/span>: file <span style=\"color:#26A269\">projet.c<\/span>, line 11.\n(gdb) run\nStarting program: <span style=\"color:#26A269\">\/home\/bruno\/Works\/langage_C\/projet\/projet<\/span> \n[Thread debugging using libthread_db enabled]\nUsing host libthread_db library &quot;<span style=\"color:#26A269\">\/lib\/x86_64-linux-gnu\/libthread_db.so.1<\/span>&quot;.\n\nBreakpoint 1, <span style=\"color:#A2734C\">main<\/span> (<span style=\"color:#2AA1B3\">argc<\/span>=1, <span style=\"color:#2AA1B3\">argv<\/span>=0x7fffffffdb98) at <span style=\"color:#26A269\">projet.c<\/span>:11\n11\t\t<b>printf<\/b> <span style=\"color:#C01C28\">(&quot;Bonjour le monde <\/span><span style=\"color:#A347BA\">\\n<\/span><span style=\"color:#C01C28\">&quot;);<\/span>\n(gdb) n\nBonjour le monde \n13\t\t<span style=\"color:#12488B\"><b>return<\/b><\/span> EXIT_SUCCESS<span style=\"color:#C01C28\">;<\/span>\n(gdb) \n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un petit script pour r\u00e9aliser un projet c de base Exemple d&rsquo;utilisation pour r\u00e9aliser un projet bonjour le monde ! Un fichier archive contient ce petit projet: skeletonc_src.tar sinon dans un r\u00e9pertoire ~\/Works\/skeletonc pour rapatrier le fichier L&rsquo;archive skeletonc_src.tar \u00e0 extraire dans \/usr\/local\/bin Ce r\u00e9pertoire permet de placer des ex\u00e9cutables accessible \u00e0 tous les utilisateurs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","footnotes":""},"class_list":["post-1038","page","type-page","status-publish","hentry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/workboot.fr\/ciela\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"Un petit script pour r\u00e9aliser un projet c de base Exemple d&rsquo;utilisation pour r\u00e9aliser un projet bonjour le monde ! Un fichier archive contient ce petit projet: skeletonc_src.tar sinon dans un r\u00e9pertoire ~\/Works\/skeletonc pour rapatrier le fichier L&rsquo;archive skeletonc_src.tar \u00e0 extraire dans \/usr\/local\/bin Ce r\u00e9pertoire permet de placer des ex\u00e9cutables accessible \u00e0 tous les utilisateurs\u2026","_links":{"self":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/1038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/comments?post=1038"}],"version-history":[{"count":18,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/1038\/revisions"}],"predecessor-version":[{"id":1075,"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/pages\/1038\/revisions\/1075"}],"wp:attachment":[{"href":"https:\/\/workboot.fr\/ciela\/wp-json\/wp\/v2\/media?parent=1038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}