<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>http://blaireaulinux.fr//wiki/index.php?action=history&amp;feed=atom&amp;title=Introduction_%C3%A0_gcc%2Fg%2B%2B</id>
	<title>Introduction à gcc/g++ - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="http://blaireaulinux.fr//wiki/index.php?action=history&amp;feed=atom&amp;title=Introduction_%C3%A0_gcc%2Fg%2B%2B"/>
	<link rel="alternate" type="text/html" href="http://blaireaulinux.fr//wiki/index.php?title=Introduction_%C3%A0_gcc/g%2B%2B&amp;action=history"/>
	<updated>2026-05-28T02:51:57Z</updated>
	<subtitle>Historique des révisions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.37.0</generator>
	<entry>
		<id>http://blaireaulinux.fr//wiki/index.php?title=Introduction_%C3%A0_gcc/g%2B%2B&amp;diff=435&amp;oldid=prev</id>
		<title>AdminWiki le 5 mars 2014 à 10:03</title>
		<link rel="alternate" type="text/html" href="http://blaireaulinux.fr//wiki/index.php?title=Introduction_%C3%A0_gcc/g%2B%2B&amp;diff=435&amp;oldid=prev"/>
		<updated>2014-03-05T10:03:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 5 mars 2014 à 12:03&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l58&quot;&gt;Ligne 58 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 58 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Voilà, maintenant vous êtes capables de créer des programmes simples en C/C++.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Voilà, maintenant vous êtes capables de créer des programmes simples en C/C++.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=Quelques options de compilation=&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &#039;&#039;&#039;-L /répertoire&#039;&#039;&#039; : répertoire où aller chercher des bibliothèques. Exemple : -L/usr/local/ssl/lib&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &#039;&#039;&#039;-l bibliothèque&#039;&#039;&#039; : bibliothèque à ajouter. Exemple : -lssl -lcrypto -lnsl -lsocket&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &#039;&#039;&#039;-static&#039;&#039;&#039; : compile en mettant toutes les bibliothèques en statique dans le binaire. Nécessite que toutes les bibliothèques en .a soient présentes. Pour ne mettre que quelques bibliothèques en statique, voir ligne suivante.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &#039;&#039;&#039;/repertoire/nom_bibliotheque.a&#039;&#039;&#039; : en passant une bibliothèque en argument (pas de tiret comme les options), on va la mettre en statique dans le binaire. Exemple : /usr/local/ssl/lib/libssl.a&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>AdminWiki</name></author>
	</entry>
	<entry>
		<id>http://blaireaulinux.fr//wiki/index.php?title=Introduction_%C3%A0_gcc/g%2B%2B&amp;diff=98&amp;oldid=prev</id>
		<title>AdminWiki : Page créée avec « Category:linux  =Introduction à gcc/g++=  Je ne suis pas un programmeur chevronné, cette rubrique sera donc très brève. Pour programmer en C/C++ sous GNU/Linux, il... »</title>
		<link rel="alternate" type="text/html" href="http://blaireaulinux.fr//wiki/index.php?title=Introduction_%C3%A0_gcc/g%2B%2B&amp;diff=98&amp;oldid=prev"/>
		<updated>2013-09-16T14:00:30Z</updated>

		<summary type="html">&lt;p&gt;Page créée avec « &lt;a href=&quot;/wiki/index.php?title=Cat%C3%A9gorie:Linux&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Catégorie:Linux (page inexistante)&quot;&gt;Category:linux&lt;/a&gt;  =Introduction à gcc/g++=  Je ne suis pas un programmeur chevronné, cette rubrique sera donc très brève. Pour programmer en C/C++ sous GNU/Linux, il... »&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:linux]]&lt;br /&gt;
&lt;br /&gt;
=Introduction à gcc/g++=&lt;br /&gt;
&lt;br /&gt;
Je ne suis pas un programmeur chevronné, cette rubrique sera donc très brève. Pour programmer en C/C++ sous GNU/Linux, il existe des logiciels tout intégrés avec une belle interface graphique comme les Borland C++ Builder ou autre Windev sous windows. Le plus connu sous Linux étant [http://www.kdevelop.org/ KDevelop].&lt;br /&gt;
&lt;br /&gt;
Les puristes préfèreront programmer directement avec un éditeur en mode texte tels [http://www.vim.org/ vi] et [http://www.gnu.org/software/emacs/emacs.html emacs] (installés par défaut sur la quasi-totalité des distributions linux). Le compilateur C/C++ utilisé en mode texte est gcc. Son utilisation est déroutante pour celui qui n&amp;#039;a programmé que sous windows, mais relativement simple, comme nous allons le voir.&lt;br /&gt;
&lt;br /&gt;
Supposons que nous ayons un programme helloworld.c que nous voulons compiler et rendre exécutable (c&amp;#039;est souvant ce qu&amp;#039;on fait d&amp;#039;un fichier *.c ;-).&lt;br /&gt;
&lt;br /&gt;
La syntaxe pour le compiler avec gcc est :&lt;br /&gt;
&lt;br /&gt;
 gcc -c helloworld.c &lt;br /&gt;
&lt;br /&gt;
puis&lt;br /&gt;
&lt;br /&gt;
 gcc -o helloworld helloworld.o&lt;br /&gt;
&lt;br /&gt;
On peut faire encore plus simple en mettant tout dans une seule ligne (mais dans ce cas le fichier helloworld.o ne sera pas créé) :&lt;br /&gt;
&lt;br /&gt;
 gcc -c helloworld.c -o helloworld&lt;br /&gt;
&lt;br /&gt;
Nous avons alors notre exécutable helloworld qui est créé (les exécutables n&amp;#039;ont traditionnellement pas d&amp;#039;extention sous linux, mais vous pouvez l&amp;#039;appeller .exe ou .toto si ça vous plait, linux ne fera aucune différence).&lt;br /&gt;
&lt;br /&gt;
Si le programme helloworld n&amp;#039;était pas encore créé, il faut préciser à Linux qu&amp;#039;il s&amp;#039;agit d&amp;#039;un exécutable. Pour cela on va taper :&lt;br /&gt;
&lt;br /&gt;
 chmod +x helloworld&lt;br /&gt;
&lt;br /&gt;
Et maintenant on peut lancer notre programme :&lt;br /&gt;
&lt;br /&gt;
 ./helloworld&lt;br /&gt;
&lt;br /&gt;
Le ./ indique que le programme se trouve dans le répertoire courant. On peut aussi le lancer en donnant le chemin compler, exemple :&lt;br /&gt;
&lt;br /&gt;
 /home/fred/prog/helloworld&lt;br /&gt;
&lt;br /&gt;
Voyons maintenant un exemple concret.&lt;br /&gt;
Voici le contenu de helloworld.c&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt; 			&lt;br /&gt;
 &lt;br /&gt;
 int main(void) 			&lt;br /&gt;
 { 			&lt;br /&gt;
   printf(&amp;quot;%s&amp;quot;, &amp;quot;hello world !\n\r&amp;quot;); 			&lt;br /&gt;
   return 0; 			&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Maintenant on obtient en ligne de commande :&lt;br /&gt;
&lt;br /&gt;
 $ gcc -c helloworld.c 			&lt;br /&gt;
 $ gcc -o helloworld helloworld.o 			&lt;br /&gt;
 $ chmod +x helloworld 			&lt;br /&gt;
 $ ./helloworld 			&lt;br /&gt;
 hello world ! 			&lt;br /&gt;
 $&lt;br /&gt;
&lt;br /&gt;
Pour programmer en C++, on fait exactement la même chose en remplaçant gcc par g++. La différence, c&amp;#039;est qu&amp;#039;ils ne vont pas chercher les bibliothèques *.h dans le même répertoire.&lt;br /&gt;
&lt;br /&gt;
Voilà, maintenant vous êtes capables de créer des programmes simples en C/C++.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Pour aller plus loin=&lt;br /&gt;
&lt;br /&gt;
Il existe des tonnes d&amp;#039;options qu&amp;#039;on peut passer à gcc, pas toutes forcément simples. De plus, il peut être vite agaçant de devoir retaper ces commandes à chaque fois qu&amp;#039;on veut tester une modification de son programme, surtout si on développe un projet contenant de nombreux fichiers liés entre eux. Pour simplifier la vie du programmeur qui veut créer de gros projets, beaucoups plus ambitieux que notre helloworld d&amp;#039;exemple, on va créer un makefile. C&amp;#039;est un fichier qui contient toutes les options de compilation du projet et qui est capable de ne lancer la compilation que des fichiers qui en ont besoin.&lt;br /&gt;
&lt;br /&gt;
Il n&amp;#039;est pas forcément aisé de créer un tel fichier, surtout quand le projet se complexifie, mais une fois que c&amp;#039;est fait, un simple appel à la commande make va tout compiler sans vous demander le moindre argument. On voit tout de suite son intérêt.&lt;br /&gt;
&lt;br /&gt;
Je ne m&amp;#039;aventurerai pas à vous en dire plus sur le sujet, j&amp;#039;en suis parfaitement incapable ;-).&lt;br /&gt;
&lt;br /&gt;
Bonne programmation !&lt;/div&gt;</summary>
		<author><name>AdminWiki</name></author>
	</entry>
</feed>