{"id":1780,"date":"2015-04-06T12:04:15","date_gmt":"2015-04-06T12:04:15","guid":{"rendered":"http:\/\/anthroponaute.fr\/blog-informatique\/?p=1780"},"modified":"2015-04-07T07:49:11","modified_gmt":"2015-04-07T07:49:11","slug":"les-en-tetes-precompiles-visual-c","status":"publish","type":"post","link":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/?p=1780","title":{"rendered":"Les fichiers d&rsquo;en-t\u00eates pr\u00e9compil\u00e9s (Visual C++)"},"content":{"rendered":"<p><a href=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/PrecompiledHeaders.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-1781\" src=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/PrecompiledHeaders.png\" alt=\"PrecompiledHeaders\" width=\"381\" height=\"660\" srcset=\"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/PrecompiledHeaders.png 418w, https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/PrecompiledHeaders-173x300.png 173w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/a><\/p>\n<p><strong>Intro :<\/strong><\/p>\n<p>Parfois, \u00e9tant donn\u00e9 le nombre faramineux de fichiers d&rsquo;en-t\u00eate n\u00e9cessaires pour compiler un fichier source .cpp, il peut etre n\u00e9cessaire de tous les regrouper en seul fichier afin de le compiler en une seule fois.<br \/>\nCette compilation acc\u00e9l\u00e8re imm\u00e9diatement la compilation des autres fichiers .cpp.<\/p>\n<p><strong>Pr\u00e9requis :<\/strong><\/p>\n<p>\u2013 Savoir un peu lire du C++<\/p>\n<p><strong>Explications :<\/strong><\/p>\n<p><strong>1)<\/strong> Ouvrez votre projet VC ++<\/p>\n<p><strong>2)<\/strong> Cr\u00e9ez un fichier Stdafx.h o\u00f9 vous mettrez tous vos fichiers .h les uns \u00e0 la suite des autres (comme dans la premi\u00e8re image).<\/p>\n<p><strong>3)<\/strong> Cr\u00e9ez juste un fichier Stdafx.cpp o\u00f9 vous metterez :<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &quot;Stdafx.h&quot;\r\n<\/pre>\n<p><strong>4) <\/strong>Faite un clic droit sur ce dernier fichier :<\/p>\n<p><a href=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_4.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1802\" src=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_4.png\" alt=\"proprieties_4\" width=\"538\" height=\"361\" srcset=\"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_4.png 538w, https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_4-300x201.png 300w\" sizes=\"(max-width: 538px) 100vw, 538px\" \/><\/a><\/p>\n<p><strong>5)<\/strong> Allez dans la partie \u00ab\u00a0En-t\u00eate pr\u00e9compil\u00e9s\u00a0\u00bb. Choisissez \u00ab\u00a0Cr\u00e9ation \/Yc\u00a0\u00bb et ajouter comme dans l&rsquo;image \u00ab\u00a0Stdafx.h\u00a0\u00bb<\/p>\n<p><a href=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_51.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1804\" src=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_51.png\" alt=\"proprieties_5\" width=\"1018\" height=\"700\" srcset=\"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_51.png 1018w, https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_51-300x206.png 300w, https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_51-624x429.png 624w\" sizes=\"(max-width: 1018px) 100vw, 1018px\" \/><\/a><\/p>\n<p><strong>6) <\/strong>Ensuite allez dans les propri\u00e9t\u00e9s du projet (ALT+F7)<\/p>\n<p><a href=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_21.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1795\" src=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_21.png\" alt=\"proprieties_2\" width=\"519\" height=\"327\" srcset=\"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_21.png 519w, https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties_21-300x189.png 300w\" sizes=\"(max-width: 519px) 100vw, 519px\" \/><\/a><\/p>\n<p><strong>7)<\/strong> Veillez \u00e0 ce que \u00ab\u00a0Stdafx.h\u00a0\u00bb soit \u00e9crit et choisissez \u00ab\u00a0Utilisation \/Yu\u00a0\u00bb :<\/p>\n<p><a href=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties.png\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1792\" src=\"https:\/\/anthropoya.cluster014.ovh.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties.png\" alt=\"proprieties\" width=\"964\" height=\"689\" srcset=\"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties.png 964w, https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties-300x214.png 300w, https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/wp-content\/uploads\/2015\/04\/proprieties-624x446.png 624w\" sizes=\"(max-width: 964px) 100vw, 964px\" \/><\/a><\/p>\n<p><strong>8) <\/strong>Dans le fichier <strong>Stdafx.h<\/strong>, vous pouvez mettre tous vos fichier <strong>#include<\/strong> :<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &quot;BoundingVolumeTrigger.h&quot;\r\n#include &quot;Mob.h&quot;\r\n#include &quot;NPC.h&quot;\r\n#include &quot;TextAnnouncer.h&quot;\r\n#include &quot;EventManager.h&quot;\r\n#include &quot;M2Importer.h&quot;\r\n#include &quot;ComputerInfo.h&quot;\r\n#include &quot;CommandsManager.h&quot;\r\n#include &quot;DataParameters.h&quot;\r\n#include &quot;Commands.h&quot;\r\n#include &quot;Actor.h&quot;\r\n#include &quot;GUIScrollBar.h&quot;\r\n#include &quot;GUIManager.h&quot;\r\n#include &quot;GUIButton.h&quot;\r\n#include &quot;GUIDraggableWindow.h&quot;\r\n<\/pre>\n<p><strong>9)<\/strong> Il reste plus qu&rsquo;\u00e0 mettre dans tous vos fichiers .cpp une seule en-t\u00eate :<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &quot;Stdafx.h&quot;\r\n<\/pre>\n<p><strong>10)<\/strong> Compilez et admirez la vitesse !<\/p>\n<p><strong>R\u00e9sum\u00e9 :<\/strong><\/p>\n<p>Nous avons appris comment regrouper un grand nombre de fichiers d&rsquo;en-t\u00eate (des #include) en un seul fichier afin de rendre la compilation beaucoup plus rapide.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Intro : Parfois, \u00e9tant donn\u00e9 le nombre faramineux de fichiers d&rsquo;en-t\u00eate n\u00e9cessaires pour compiler un fichier source .cpp, il peut etre n\u00e9cessaire de tous les regrouper en seul fichier afin de le compiler en une seule fois. Cette compilation acc\u00e9l\u00e8re imm\u00e9diatement la compilation des autres fichiers .cpp. Pr\u00e9requis : \u2013 Savoir un peu lire du [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=\/wp\/v2\/posts\/1780"}],"collection":[{"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1780"}],"version-history":[{"count":31,"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=\/wp\/v2\/posts\/1780\/revisions"}],"predecessor-version":[{"id":1784,"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=\/wp\/v2\/posts\/1780\/revisions\/1784"}],"wp:attachment":[{"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.la-porte-des-nebuleuses.net\/blog-informatique\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}